Rubber band in play mode disabled

preferencesAboutTextFull
Ilia Ryabokon 12 years ago
parent a55b01c962
commit 19d31ccc55
  1. 54
      src/board/UBBoardView.cpp
  2. 1
      src/board/UBBoardView.h

@ -75,6 +75,7 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool
, mIsDragInProgress(false) , mIsDragInProgress(false)
, mMultipleSelectionIsEnabled(false) , mMultipleSelectionIsEnabled(false)
, isControl(pIsControl) , isControl(pIsControl)
, mRubberBandInPlayMode(false) //enables rubberband with play tool
{ {
init (); init ();
@ -1020,38 +1021,41 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
return; 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<QGraphicsItem *> rubberItems = items(bandRect); mUBRubberBand->setGeometry(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 QList<QGraphicsItem *> rubberItems = items(bandRect);
|| item->type() == UBGraphicsPixmapItem::Type foreach (QGraphicsItem *item, mJustSelectedItems) {
|| item->type() == UBGraphicsMediaItem::Type if (!rubberItems.contains(item)) {
|| item->type() == UBGraphicsSvgItem::Type item->setSelected(false);
|| item->type() == UBGraphicsTextItem::Type mJustSelectedItems.remove(item);
|| item->type() == UBGraphicsStrokesGroup::Type
|| item->type() == UBGraphicsGroupContainerItem::Type) {
if (!mJustSelectedItems.contains(item)) {
item->setSelected(true);
mJustSelectedItems.insert(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);
}
}
}
} }
} }

@ -154,6 +154,7 @@ class UBBoardView : public QGraphicsView
bool mIsDragInProgress; bool mIsDragInProgress;
bool mMultipleSelectionIsEnabled; bool mMultipleSelectionIsEnabled;
bool isControl; bool isControl;
bool mRubberBandInPlayMode;
static bool hasSelectedParents(QGraphicsItem * item); static bool hasSelectedParents(QGraphicsItem * item);

Loading…
Cancel
Save