Commit f439183c authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Tim Jenssen

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's avatarTim Jenssen <tim.jenssen@qt.io>
parent 91cda49d
......@@ -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()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment