diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index eb7834e5..135f1b40 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.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) { diff --git a/src/board/UBFeaturesController.cpp b/src/board/UBFeaturesController.cpp index 79a2760c..d34228e6 100644 --- a/src/board/UBFeaturesController.cpp +++ b/src/board/UBFeaturesController.cpp @@ -59,7 +59,7 @@ const QString UBFeaturesController::webSearchPath = rootPath + "/Web search"; void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & currVirtualPath, const QSet &pFavoriteSet) { - Q_ASSERT(QFileInfo(currentPath.toLocalFile()).exists()); +// Q_ASSERT(QFileInfo(currentPath.toLocalFile()).exists()); QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(currentPath.toLocalFile()); diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index 440c4c15..64564a4a 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -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 diff --git a/src/domain/UBGraphicsItemDelegate.h b/src/domain/UBGraphicsItemDelegate.h index 6715cf99..5c892946 100644 --- a/src/domain/UBGraphicsItemDelegate.h +++ b/src/domain/UBGraphicsItemDelegate.h @@ -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); diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 2e0f44c9..2315b16b 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -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(); diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h index f0a38752..54bc267f 100644 --- a/src/domain/UBGraphicsScene.h +++ b/src/domain/UBGraphicsScene.h @@ -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; }; diff --git a/src/domain/UBGraphicsStrokesGroup.cpp b/src/domain/UBGraphicsStrokesGroup.cpp index 3b2322df..b371becd 100644 --- a/src/domain/UBGraphicsStrokesGroup.cpp +++ b/src/domain/UBGraphicsStrokesGroup.cpp @@ -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;