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>
This commit is contained in:
Thomas Hartmann
2017-08-17 14:11:26 +02:00
committed by Tim Jenssen
parent 91cda49d7c
commit f439183c8d

View File

@@ -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()) {