Multiple selection is disabled after application restore. (ctrl+h was enables multiple selection).

preferencesAboutTextFull
Aleksei Kanash 12 years ago
parent afb257119a
commit c67392ea68
  1. 19
      src/board/UBBoardView.cpp
  2. 3
      src/board/UBBoardView.h
  3. 6
      src/core/UBApplication.cpp

@ -214,7 +214,7 @@ UBBoardView::keyPressEvent (QKeyEvent *event)
case Qt::Key_Control: case Qt::Key_Control:
case Qt::Key_Shift: case Qt::Key_Shift:
{ {
mMultipleSelectionIsEnabled = true; setMultiselection(true);
}break; }break;
} }
@ -274,6 +274,10 @@ UBBoardView::keyPressEvent (QKeyEvent *event)
} }
} }
} }
// if ctrl of shift was pressed combined with other keys - we need to disable multiple selection.
if (event->isAccepted())
setMultiselection(false);
} }
@ -284,7 +288,7 @@ void UBBoardView::keyReleaseEvent(QKeyEvent *event)
if (Qt::Key_Shift == event->key() if (Qt::Key_Shift == event->key()
||Qt::Key_Control == event->key()) ||Qt::Key_Control == event->key())
{ {
mMultipleSelectionIsEnabled = false; setMultiselection(false);
} }
} }
@ -459,7 +463,7 @@ void UBBoardView::handleItemsSelection(QGraphicsItem *item)
// if we need to uwe multiple selection - we shouldn't deselect other items. // if we need to uwe multiple selection - we shouldn't deselect other items.
if (!mMultipleSelectionIsEnabled) if (!isMultipleSelectionEnabled())
{ {
// here we need to determine what item is pressed. We should work // here we need to determine what item is pressed. We should work
// only with UB items. // only with UB items.
@ -694,7 +698,7 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
handleItemsSelection(movingItem); handleItemsSelection(movingItem);
if (mMultipleSelectionIsEnabled) if (isMultipleSelectionEnabled())
return; return;
if (itemShouldReceiveMousePressEvent(movingItem)) if (itemShouldReceiveMousePressEvent(movingItem))
@ -792,6 +796,11 @@ void UBBoardView::moveRubberedItems(QPointF movingVector)
scene()->invalidate(invalidateRect); scene()->invalidate(invalidateRect);
} }
void UBBoardView::setMultiselection(bool enable)
{
mMultipleSelectionIsEnabled = enable;
}
void UBBoardView::longPressEvent() void UBBoardView::longPressEvent()
{ {
UBDrawingController *drawingController = UBDrawingController::drawingController(); UBDrawingController *drawingController = UBDrawingController::drawingController();
@ -1090,7 +1099,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
!(movingItem->parentItem() && UBGraphicsW3CWidgetItem::Type == movingItem->type() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type())) !(movingItem->parentItem() && UBGraphicsW3CWidgetItem::Type == movingItem->type() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type()))
{ {
bReleaseIsNeed = false; bReleaseIsNeed = false;
if (movingItem->isSelected() && mMultipleSelectionIsEnabled) if (movingItem->isSelected() && isMultipleSelectionEnabled())
movingItem->setSelected(false); movingItem->setSelected(false);
else else
{ {

@ -44,6 +44,9 @@ class UBBoardView : public QGraphicsView
void rubberItems(); void rubberItems();
void moveRubberedItems(QPointF movingVector); void moveRubberedItems(QPointF movingVector);
void setMultiselection(bool enable);
bool isMultipleSelectionEnabled() { return mMultipleSelectionIsEnabled; }
signals: signals:
void resized(QResizeEvent* event); void resized(QResizeEvent* event);

@ -582,6 +582,12 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event)
boardController->controlView()->forcedTabletRelease(); boardController->controlView()->forcedTabletRelease();
} }
if (event->type() == QEvent::ApplicationActivate)
{
boardController->controlView()->setMultiselection(false);
}
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
if (bIsMinimized && event->type() == QEvent::ApplicationActivate){ if (bIsMinimized && event->type() == QEvent::ApplicationActivate){
if (mainWindow->isHidden()) mainWindow->show(); if (mainWindow->isHidden()) mainWindow->show();

Loading…
Cancel
Save