From 19d31ccc55595daffecf1f8749e785fae1ccfeb7 Mon Sep 17 00:00:00 2001 From: Ilia Ryabokon Date: Thu, 30 Aug 2012 12:35:22 +0300 Subject: [PATCH] Rubber band in play mode disabled --- src/board/UBBoardView.cpp | 54 +++++++++++++++++++++------------------ src/board/UBBoardView.h | 1 + 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index 9dab0121..ed75f550 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -75,6 +75,7 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool , mIsDragInProgress(false) , mMultipleSelectionIsEnabled(false) , isControl(pIsControl) +, mRubberBandInPlayMode(false) //enables rubberband with play tool { init (); @@ -1020,38 +1021,41 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event) return; } - if (!movingItem && (mMouseButtonIsPressed || mTabletStylusIsPressed) && mUBRubberBand && mUBRubberBand->isVisible()) { + if (currentTool != UBStylusTool::Play || mRubberBandInPlayMode) { - QRect bandRect(mMouseDownPos, event->pos()); + if (!movingItem && (mMouseButtonIsPressed || mTabletStylusIsPressed) && mUBRubberBand && mUBRubberBand->isVisible()) { - bandRect = bandRect.normalized(); + QRect bandRect(mMouseDownPos, event->pos()); - mUBRubberBand->setGeometry(bandRect); + bandRect = bandRect.normalized(); - QList rubberItems = items(bandRect); - foreach (QGraphicsItem *item, mJustSelectedItems) { - if (!rubberItems.contains(item)) { - item->setSelected(false); - mJustSelectedItems.remove(item); - } - } - - if (currentTool == UBStylusTool::Selector) - foreach (QGraphicsItem *item, items(bandRect)) { + mUBRubberBand->setGeometry(bandRect); - if (item->type() == UBGraphicsW3CWidgetItem::Type - || item->type() == UBGraphicsPixmapItem::Type - || item->type() == UBGraphicsMediaItem::Type - || item->type() == UBGraphicsSvgItem::Type - || item->type() == UBGraphicsTextItem::Type - || item->type() == UBGraphicsStrokesGroup::Type - || item->type() == UBGraphicsGroupContainerItem::Type) { - - if (!mJustSelectedItems.contains(item)) { - item->setSelected(true); - mJustSelectedItems.insert(item); + QList rubberItems = items(bandRect); + foreach (QGraphicsItem *item, mJustSelectedItems) { + if (!rubberItems.contains(item)) { + item->setSelected(false); + mJustSelectedItems.remove(item); } } + + if (currentTool == UBStylusTool::Selector) + foreach (QGraphicsItem *item, items(bandRect)) { + + if (item->type() == UBGraphicsW3CWidgetItem::Type + || item->type() == UBGraphicsPixmapItem::Type + || item->type() == UBGraphicsMediaItem::Type + || item->type() == UBGraphicsSvgItem::Type + || item->type() == UBGraphicsTextItem::Type + || item->type() == UBGraphicsStrokesGroup::Type + || item->type() == UBGraphicsGroupContainerItem::Type) { + + if (!mJustSelectedItems.contains(item)) { + item->setSelected(true); + mJustSelectedItems.insert(item); + } + } + } } } diff --git a/src/board/UBBoardView.h b/src/board/UBBoardView.h index 0794d76c..5c486a30 100644 --- a/src/board/UBBoardView.h +++ b/src/board/UBBoardView.h @@ -154,6 +154,7 @@ class UBBoardView : public QGraphicsView bool mIsDragInProgress; bool mMultipleSelectionIsEnabled; bool isControl; + bool mRubberBandInPlayMode; static bool hasSelectedParents(QGraphicsItem * item);