Allow designeractions to target specific views

This is needed for the "connect signal to event dialog" which resides in
a different plugin but needs to be opened from the connection editor.

Change-Id: I9e200791831fa46d65e5f833e14a0d893fc29432
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Knud Dollereder
2020-12-17 13:06:15 +01:00
parent b11d8aa92a
commit 7c1e210d2c
4 changed files with 29 additions and 0 deletions

View File

@@ -172,6 +172,16 @@ void ConnectionViewWidget::contextMenuEvent(QContextMenuEvent *event)
m_connectionEditor->updateWindowName();
});
QMap<QString, QVariant> data;
data["ModelNode"] = index.siblingAtColumn(ConnectionModel::TargetModelNodeRow).data();
data["Signal"] = index.siblingAtColumn(ConnectionModel::TargetPropertyNameRow).data();
DesignerActionManager &designerActionManager = QmlDesignerPlugin::instance()->designerActionManager();
for (auto actionInterface : designerActionManager.actionsForTarget(ActionInterface::Target::ConnectionEditor)) {
auto *action = actionInterface->action();
action->setData(data);
menu.addAction(action);
}
menu.exec(event->globalPos());
}
break;