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

preferencesAboutTextFull
Aleksei Kanash 12 years ago
parent afb257119a
commit c67392ea68
  1. 35
      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.
@ -627,8 +631,8 @@ QGraphicsItem* UBBoardView::determineItemToPress(QGraphicsItem *item)
{ {
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController()->stylusTool(); UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController()->stylusTool();
// groups should should be moved instead of strokes groups // groups should should be moved instead of strokes groups
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 froup is not selected - group should take press.
@ -687,14 +691,14 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
{ {
mLastPressedMousePos = mapToScene(event->pos()); mLastPressedMousePos = mapToScene(event->pos());
// 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); QGraphicsItem *pressedItem = determineItemToPress(movingItem);
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