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)
, 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<QGraphicsItem *> 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<QGraphicsItem *> 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);
}
}
}
}
}

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

Loading…
Cancel
Save