Fixed multiple selection for stokes and for groups (if click on w3c).

preferencesAboutTextFull
Aleksei Kanash 12 years ago
parent d5a20e6d3c
commit 4772233b60
  1. 24
      src/board/UBBoardView.cpp

@ -524,14 +524,13 @@ Here we determines cases when items should to get mouse press event at pressing
break; break;
// Groups shouldn't reacts on any presses and moves for Play tool. // Groups shouldn't reacts on any presses and moves for Play tool.
case UBGraphicsStrokesGroup::Type:
case UBGraphicsGroupContainerItem::Type: case UBGraphicsGroupContainerItem::Type:
if(currentTool == UBStylusTool::Play) if(currentTool == UBStylusTool::Play)
{ {
movingItem = NULL; movingItem = NULL;
return false;
} }
else return false;
return true;
break; break;
case QGraphicsWebView::Type: case QGraphicsWebView::Type:
@ -574,10 +573,8 @@ bool UBBoardView::itemShouldReceiveSuspendedMousePressEvent(QGraphicsItem *item)
return true; return true;
} }
if (!dynamic_cast<UBGraphicsItem*>(item))
return true;
else
return false; return false;
} }
bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item) bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item)
@ -635,8 +632,11 @@ QGraphicsItem* UBBoardView::determineItemToPress(QGraphicsItem *item)
if (item->parentItem() && UBGraphicsStrokesGroup::Type == item->type()) if (item->parentItem() && UBGraphicsStrokesGroup::Type == item->type())
return item->parentItem(); return item->parentItem();
// if item is on group and froup is not selected - group should take press. // if item is on group and group is not selected - group should take press.
if (UBStylusTool::Selector == currentTool && item->parentItem() && UBGraphicsGroupContainerItem::Type == item->parentItem()->type() && !item->parentItem()->isSelected()) if (UBStylusTool::Selector == currentTool
&& item->parentItem()
&& UBGraphicsGroupContainerItem::Type == item->parentItem()->type()
&& !item->parentItem()->isSelected())
return item->parentItem(); return item->parentItem();
// items like polygons placed in two groups nested, so we need to recursive call. // items like polygons placed in two groups nested, so we need to recursive call.
@ -694,8 +694,7 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
// Determining item who will take mouse press event // Determining item who will take mouse press event
//all other items will be deselected and if all item will be deselected, then //all other items will be deselected and if all item will be deselected, then
// wrong item can catch mouse press. because selected items placed on the top // wrong item can catch mouse press. because selected items placed on the top
QGraphicsItem *pressedItem = determineItemToPress(movingItem); movingItem = determineItemToPress(movingItem);
handleItemsSelection(movingItem); handleItemsSelection(movingItem);
if (isMultipleSelectionEnabled()) if (isMultipleSelectionEnabled())
@ -1096,12 +1095,15 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
UBGraphicsDelegateFrame::Type != movingItem->type() && UBGraphicsDelegateFrame::Type != movingItem->type() &&
UBToolWidget::Type != movingItem->type() && UBToolWidget::Type != movingItem->type() &&
QGraphicsWebView::Type != movingItem->type() && // for W3C widgets as Tools. QGraphicsWebView::Type != movingItem->type() && // for W3C widgets as Tools.
!(movingItem->parentItem() && UBGraphicsW3CWidgetItem::Type == movingItem->type() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type())) !(!isMultipleSelectionEnabled() && movingItem->parentItem() && UBGraphicsWidgetItem::Type == movingItem->type() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type()))
{ {
bReleaseIsNeed = false; bReleaseIsNeed = false;
if (movingItem->isSelected() && isMultipleSelectionEnabled()) if (movingItem->isSelected() && isMultipleSelectionEnabled())
movingItem->setSelected(false); movingItem->setSelected(false);
else else
if (movingItem->parentItem() && movingItem->parentItem()->isSelected() && isMultipleSelectionEnabled())
movingItem->parentItem()->setSelected(false);
else
{ {
if (movingItem->isSelected()) if (movingItem->isSelected())
bReleaseIsNeed = true; bReleaseIsNeed = true;

Loading…
Cancel
Save