diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2017-08-17 14:11:26 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@qt.io> | 2017-09-13 10:36:20 +0000 |
commit | f439183c8db9680e082316b56b43a46863d1c3a5 (patch) | |
tree | b98713f9486be13eecc3a8c8861fb8339337c02d | |
parent | 91cda49d7c1d012e67ffba3cbf0a433ede1bb85a (diff) | |
download | qt-creator-f439183c8db9680e082316b56b43a46863d1c3a5.tar.gz |
QmlDesigner: Change selection in the release event
We already change the selection currently in the press event,
which leads wo weird behaivour if e.g. shift is pressed.
In this case the item is immediately unselected which is unexpected
and cannot be moved anymore.
Generally reacting to the event in the release event is the correct way
to do it.
Change-Id: Ib765f97f85e5dbeb6148d48f8640f1798a057b48
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
-rw-r--r-- | src/plugins/qmldesigner/components/formeditor/selectiontool.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp b/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp index 9938c8f065..559cec498e 100644 --- a/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp @@ -71,13 +71,6 @@ void SelectionTool::mousePressEvent(const QList<QGraphicsItem*> &itemList, m_itemAlreadySelected = toQmlItemNodeList(view()->selectedModelNodes()).contains(formEditorItem->qmlItemNode()) || !view()->hasSingleSelectedModelNode(); - - if (event->modifiers().testFlag(Qt::ControlModifier)) - m_singleSelectionManipulator.select(SingleSelectionManipulator::InvertSelection); - else if (event->modifiers().testFlag(Qt::ShiftModifier)) - m_singleSelectionManipulator.select(SingleSelectionManipulator::InvertSelection); - else - m_singleSelectionManipulator.select(SingleSelectionManipulator::ReplaceSelection); } else { if (event->modifiers().testFlag(Qt::AltModifier)) { m_singleSelectionManipulator.begin(event->scenePos()); @@ -168,6 +161,12 @@ void SelectionTool::mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, { if (event->button() == Qt::LeftButton) { if (m_singleSelectionManipulator.isActive()) { + if (event->modifiers().testFlag(Qt::ControlModifier)) + m_singleSelectionManipulator.select(SingleSelectionManipulator::InvertSelection); + else if (event->modifiers().testFlag(Qt::ShiftModifier)) + m_singleSelectionManipulator.select(SingleSelectionManipulator::InvertSelection); + else + m_singleSelectionManipulator.select(SingleSelectionManipulator::ReplaceSelection); m_singleSelectionManipulator.end(event->scenePos()); } else if (m_rubberbandSelectionManipulator.isActive()) { |