From f439183c8db9680e082316b56b43a46863d1c3a5 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 17 Aug 2017 14:11:26 +0200 Subject: 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 --- .../qmldesigner/components/formeditor/selectiontool.cpp | 13 ++++++------- 1 file 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 &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 &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()) { -- cgit v1.2.1