diff options
author | Jochen Becher <jochen_becher@gmx.de> | 2015-09-25 17:18:50 +0200 |
---|---|---|
committer | Jochen Becher <jochen_becher@gmx.de> | 2015-09-30 18:54:13 +0000 |
commit | 0954b3869781768b3466f98a70473a5c8a0f0667 (patch) | |
tree | 945163b514db142fa1c9b7227d4e3ef4b6e781c2 /src/plugins/modeleditor/actionhandler.cpp | |
parent | c39242c16638bf80a8325ea796c15feb4200510a (diff) |
ModelEditor: Add new button to open parent diagram
If the currently open diagram has a parent diagram (that is: a diagram
in the package one hierarchy step up) it can now be opened by pressing a
button in the toolbar. Default short cut is Ctrl+Shift+P.
This change completes the navigation features.
Change-Id: Ie073676644a6283842b2bbb0d14aca1dfe2706e7
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Diffstat (limited to 'src/plugins/modeleditor/actionhandler.cpp')
-rw-r--r-- | src/plugins/modeleditor/actionhandler.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/modeleditor/actionhandler.cpp b/src/plugins/modeleditor/actionhandler.cpp index 151fc63de7..0040ac3cfe 100644 --- a/src/plugins/modeleditor/actionhandler.cpp +++ b/src/plugins/modeleditor/actionhandler.cpp @@ -56,6 +56,7 @@ public: QAction *removeAction = 0; QAction *deleteAction = 0; QAction *selectAllAction = 0; + QAction *openParentDiagramAction = 0; }; ActionHandler::ActionHandler(const Core::Context &context, QObject *parent) @@ -110,6 +111,11 @@ QAction *ActionHandler::selectAllAction() const return d->selectAllAction; } +QAction *ActionHandler::openParentDiagramAction() const +{ + return d->openParentDiagramAction; +} + void ActionHandler::createActions() { Core::ActionContainer *medit = Core::ActionManager::actionContainer(Core::Constants::M_EDIT); @@ -130,6 +136,10 @@ void ActionHandler::createActions() medit->addAction(deleteCommand, Core::Constants::G_EDIT_COPYPASTE); d->deleteAction = deleteCommand->action(); d->selectAllAction = registerCommand(Core::Constants::SELECTALL, [this]() { selectAll(); })->action(); + d->openParentDiagramAction = registerCommand( + Constants::OPEN_PARENT_DIAGRAM, [this]() { openParentDiagram(); }, true, + tr("Open Parent Diagram"), QKeySequence(QStringLiteral("Ctrl+Shift+P")))->action(); + d->openParentDiagramAction->setIcon(QIcon(QStringLiteral(":/modeleditor/up.png"))); registerCommand(Constants::ACTION_ADD_PACKAGE, nullptr); registerCommand(Constants::ACTION_ADD_COMPONENT, nullptr); registerCommand(Constants::ACTION_ADD_CLASS, nullptr); @@ -201,6 +211,13 @@ void ActionHandler::selectAll() editor->selectAll(); } +void ActionHandler::openParentDiagram() +{ + auto editor = dynamic_cast<ModelEditor *>(Core::EditorManager::currentEditor()); + if (editor) + editor->openParentDiagram(); +} + void ActionHandler::onEditProperties() { auto editor = qobject_cast<ModelEditor *>(Core::EditorManager::currentEditor()); |