diff options
author | Jochen Becher <jochen_becher@gmx.de> | 2016-02-22 20:59:28 +0100 |
---|---|---|
committer | Jochen Becher <jochen_becher@gmx.de> | 2016-02-24 17:22:38 +0000 |
commit | bbba9ccae39ef293a144c7843e49170392362d57 (patch) | |
tree | 6f5f70d644168ad09320d96cd7adee47778ff83d /src/plugins/modeleditor/actionhandler.cpp | |
parent | 537125155df99819f353b532943d34d6ba025440 (diff) |
ModelEditor: Export diagram as image, pdf or svg
Change-Id: I19be1de5f0c8414b4d76dbbbb68e71183b7ce08e
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Diffstat (limited to 'src/plugins/modeleditor/actionhandler.cpp')
-rw-r--r-- | src/plugins/modeleditor/actionhandler.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/plugins/modeleditor/actionhandler.cpp b/src/plugins/modeleditor/actionhandler.cpp index 768e6872b6..77895787f2 100644 --- a/src/plugins/modeleditor/actionhandler.cpp +++ b/src/plugins/modeleditor/actionhandler.cpp @@ -36,6 +36,7 @@ #include <QAction> #include <QShortcut> +#include <QMenu> namespace ModelEditor { namespace Internal { @@ -52,6 +53,7 @@ public: QAction *deleteAction = 0; QAction *selectAllAction = 0; QAction *openParentDiagramAction = 0; + QAction *exportDiagramAction = 0; }; ActionHandler::ActionHandler(const Core::Context &context, QObject *parent) @@ -111,6 +113,11 @@ QAction *ActionHandler::openParentDiagramAction() const return d->openParentDiagramAction; } +QAction *ActionHandler::exportDiagramAction() const +{ + return d->exportDiagramAction; +} + void ActionHandler::createActions() { Core::ActionContainer *medit = Core::ActionManager::actionContainer(Core::Constants::M_EDIT); @@ -131,6 +138,18 @@ void ActionHandler::createActions() medit->addAction(deleteCommand, Core::Constants::G_EDIT_COPYPASTE); d->deleteAction = deleteCommand->action(); d->selectAllAction = registerCommand(Core::Constants::SELECTALL, [this]() { selectAll(); }, d->context)->action(); + + Core::ActionContainer *menuModelEditor = Core::ActionManager::createMenu(Constants::MENU_ID); + menuModelEditor->menu()->setTitle(tr("Model Editor")); + Core::ActionContainer *menuTools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); + menuTools->addMenu(menuModelEditor); + + Core::Command *exportDiagramCommand = registerCommand( + Constants::EXPORT_DIAGRAM, [this]() { exportDiagram(); }, Core::Context(), true, + tr("Export Diagram...")); + menuModelEditor->addAction(exportDiagramCommand); + d->exportDiagramAction = exportDiagramCommand->action(); + d->openParentDiagramAction = registerCommand( Constants::OPEN_PARENT_DIAGRAM, [this]() { openParentDiagram(); }, Core::Context(), true, tr("Open Parent Diagram"), QKeySequence(QStringLiteral("Ctrl+Shift+P")))->action(); @@ -230,6 +249,13 @@ void ActionHandler::onEditItem() editor->editSelectedItem(); } +void ActionHandler::exportDiagram() +{ + auto editor = qobject_cast<ModelEditor *>(Core::EditorManager::currentEditor()); + if (editor) + editor->exportDiagram(); +} + Core::Command *ActionHandler::registerCommand(const Core::Id &id, const std::function<void()> &slot, const Core::Context &context, bool scriptable, const QString &title, const QKeySequence &keySequence) |