Selection process changed

preferencesAboutTextFull
Ilia Ryabokon 12 years ago
parent a6ec6d7aec
commit c65efdee23
  1. 14
      src/board/UBBoardView.cpp
  2. 2
      src/board/UBFeaturesController.cpp
  3. 32
      src/domain/UBGraphicsItemDelegate.cpp
  4. 2
      src/domain/UBGraphicsItemDelegate.h
  5. 3
      src/domain/UBGraphicsScene.cpp
  6. 3
      src/domain/UBGraphicsScene.h
  7. 12
      src/domain/UBGraphicsStrokesGroup.cpp

@ -1023,11 +1023,13 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
}
mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
mUBRubberBand->show();
scene()->setMultipleSelectionProcess(true);
}
else
{
if(mUBRubberBand)
mUBRubberBand->hide();
scene()->setMultipleSelectionProcess(false);
}
handleItemMousePress(event);
@ -1061,6 +1063,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
mRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
mRubberBand->show ();
mIsCreatingTextZone = true;
scene()->setMultipleSelectionProcess(true);
event->accept ();
}
@ -1075,6 +1078,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
mRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
mRubberBand->show ();
mIsCreatingSceneGrabZone = true;
scene()->setMultipleSelectionProcess(true);
event->accept ();
}
@ -1283,6 +1287,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
if (mUBRubberBand && mUBRubberBand->isVisible()) {
mUBRubberBand->hide();
scene()->setMultipleSelectionProcess(false);
}
if (bReleaseIsNeed)
@ -1316,8 +1321,11 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
}
else if (currentTool == UBStylusTool::Text)
{
if (mRubberBand)
if (mRubberBand) {
mRubberBand->hide ();
scene()->setMultipleSelectionProcess(false);
}
if (scene () && mRubberBand && mIsCreatingTextZone)
{
@ -1340,8 +1348,10 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
}
else if (currentTool == UBStylusTool::Capture)
{
if (mRubberBand)
if (mRubberBand) {
mRubberBand->hide ();
scene()->setMultipleSelectionProcess(false);
}
if (scene () && mRubberBand && mIsCreatingSceneGrabZone && mRubberBand->geometry ().width () > 16)
{

@ -59,7 +59,7 @@ const QString UBFeaturesController::webSearchPath = rootPath + "/Web search";
void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & currVirtualPath, const QSet<QUrl> &pFavoriteSet)
{
Q_ASSERT(QFileInfo(currentPath.toLocalFile()).exists());
// Q_ASSERT(QFileInfo(currentPath.toLocalFile()).exists());
QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(currentPath.toLocalFile());

@ -226,6 +226,16 @@ void UBGraphicsItemDelegate::init()
setRotatable(false);
}
void UBGraphicsItemDelegate::createControls()
{
}
void UBGraphicsItemDelegate::freeControls()
{
}
UBGraphicsItemDelegate::~UBGraphicsItemDelegate()
{
@ -242,9 +252,10 @@ QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange ch
if (change == QGraphicsItem::ItemSelectedHasChanged) {
bool ok;
bool selected = value.toUInt(&ok);
if (ok) {
UBGraphicsScene *ubScene = castUBGraphicsScene();
if (ubScene) {
if (ubScene && !ubScene->multipleSelectionProcess()) {
if (selected) {
ubScene->setSelectedZLevel(delegated());
} else {
@ -254,15 +265,16 @@ QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange ch
}
}
if ((change == QGraphicsItem::ItemSelectedHasChanged
|| change == QGraphicsItem::ItemPositionHasChanged
|| change == QGraphicsItem::ItemTransformHasChanged)
&& mDelegated->scene()
&& UBApplication::boardController)
{
mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom());
positionHandles();
}
// if ((change == QGraphicsItem::ItemSelectedHasChanged
// || change == QGraphicsItem::ItemPositionHasChanged
// || change == QGraphicsItem::ItemTransformHasChanged)
// && mDelegated->scene()
// && UBApplication::boardController)
// {
// mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom());
// positionHandles();
// }
if (change == QGraphicsItem::ItemPositionHasChanged
|| change == QGraphicsItem::ItemTransformHasChanged

@ -220,6 +220,8 @@ class UBGraphicsItemDelegate : public QObject
virtual ~UBGraphicsItemDelegate();
void init();
void createControls();
void freeControls();
virtual bool mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual bool mouseMoveEvent(QGraphicsSceneMouseEvent *event);

@ -287,6 +287,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta
, mZLayerController(new UBZLayerController(this))
, mpLastPolygon(NULL)
, mCurrentPolygon(0)
, mMultipleSelectionProcess(false)
{
UBCoreGraphicsScene::setObjectName("BoardScene");
#ifdef __ppc__
@ -295,6 +296,8 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta
mShouldUseOMP = QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5;
#endif
setItemIndexMethod(QGraphicsScene::BspTreeIndex);
setUuid(QUuid::createUuid());
setDocument(parent);
createEraiser();

@ -310,6 +310,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
static QUuid getPersonalUuid(QGraphicsItem *item);
UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon);
void setMultipleSelectionProcess(bool pEnabled) {mMultipleSelectionProcess = pEnabled;}
bool multipleSelectionProcess() const {return mMultipleSelectionProcess;}
public slots:
void initStroke();
@ -427,6 +429,7 @@ public slots:
bool mDrawWithCompass;
UBGraphicsPolygonItem *mCurrentPolygon;
bool mMultipleSelectionProcess;
};

@ -181,9 +181,18 @@ void UBGraphicsStrokesGroup::paint(QPainter *painter, const QStyleOptionGraphics
{
// Never draw the rubber band, we draw our custom selection with the DelegateFrame
QStyleOptionGraphicsItem styleOption = QStyleOptionGraphicsItem(*option);
bool selectedState = false;
if (styleOption.state & QStyle::State_Selected) {
selectedState = true;
}
styleOption.state &= ~QStyle::State_Selected;
QGraphicsItemGroup::paint(painter, &styleOption, widget);
if (selectedState) {
painter->save();
painter->setBrush(QColor(0x88, 0x88, 0x88, 0x77));
painter->drawRect(boundingRect());
painter->restore();
}
}
QVariant UBGraphicsStrokesGroup::itemChange(GraphicsItemChange change, const QVariant &value)
@ -192,7 +201,6 @@ QVariant UBGraphicsStrokesGroup::itemChange(GraphicsItemChange change, const QVa
return QGraphicsItemGroup::itemChange(change, newValue);
}
QPainterPath UBGraphicsStrokesGroup::shape () const
{
QPainterPath path;

Loading…
Cancel
Save