QmlDesigner.ContextMenu: Fix regression

We have to create a local SelectionContext for the target node.

Change-Id: I69a490fbc154d5cc15d9ea4f40899afdbab77a7c
Reviewed-by: Marco Bubke <marco.bubke@digia.com>
This commit is contained in:
Thomas Hartmann
2014-06-19 16:52:15 +02:00
parent 7894bd6acb
commit 4f5f56c810

View File

@@ -167,10 +167,13 @@ public:
selectionAction->setParent(menu());
parentNode = selectionContext().currentSingleSelectedNode().parentProperty().parentModelNode();
selectionContext().setTargetNode(parentNode);
selectionAction->setText(QString(QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Select parent: %1")).arg(
captionForModelNode(parentNode)));
selectionAction->setSelectionContext(selectionContext());
SelectionContext nodeSelectionContext = selectionContext();
nodeSelectionContext.setTargetNode(parentNode);
selectionAction->setSelectionContext(nodeSelectionContext);
menu()->addAction(selectionAction);
}
@@ -182,7 +185,10 @@ public:
selectionContext().setTargetNode(node);
QString what = QString(QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Select: %1")).arg(captionForModelNode(node));
ActionTemplate *selectionAction = new ActionTemplate(what, &ModelNodeOperations::select);
selectionAction->setSelectionContext(selectionContext());
SelectionContext nodeSelectionContext = selectionContext();
nodeSelectionContext.setTargetNode(node);
selectionAction->setSelectionContext(nodeSelectionContext);
menu()->addAction(selectionAction);
}