diff options
author | Jochen Becher <jochen_becher@gmx.de> | 2017-12-22 20:25:39 +0100 |
---|---|---|
committer | Jochen Becher <jochen_becher@gmx.de> | 2018-01-09 14:21:46 +0000 |
commit | 9c8086610ef4676e6d0b6a6e744ed6144f6d0dad (patch) | |
tree | d242e857c637b7943b14e4d1c5fd0fe3019bcc45 /src/plugins/modeleditor/actionhandler.cpp | |
parent | cdc5b9265b075b10c6a07dd231404104cd125946 (diff) |
ModelEditor: Improve export of diagrams
Implemented new menu item "Export Selected Elements" exporting only
selected elements from diagram to image file. The existing menu item
"Export Diagram" exports the whole diagram always. In both cases any
selection will be removed from the diagram before export and restored
afterwards.
Task.number: QTCREATORBUG-16689
Change-Id: If9ad5d38a690fe8dc4b18624d0ddc81618b117d1
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/modeleditor/actionhandler.cpp')
-rw-r--r-- | src/plugins/modeleditor/actionhandler.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/plugins/modeleditor/actionhandler.cpp b/src/plugins/modeleditor/actionhandler.cpp index 016a0ad027..d03730ccfe 100644 --- a/src/plugins/modeleditor/actionhandler.cpp +++ b/src/plugins/modeleditor/actionhandler.cpp @@ -57,6 +57,7 @@ public: QAction *openParentDiagramAction = nullptr; QAction *synchronizeBrowserAction = nullptr; QAction *exportDiagramAction = nullptr; + QAction *exportSelectedElementsAction = nullptr; QAction *zoomInAction = nullptr; QAction *zoomOutAction = nullptr; QAction *resetZoomAction = nullptr; @@ -129,6 +130,11 @@ QAction *ActionHandler::exportDiagramAction() const return d->exportDiagramAction; } +QAction *ActionHandler::exportSelectedElementsAction() const +{ + return d->exportSelectedElementsAction; +} + QAction *ActionHandler::zoomInAction() const { return d->zoomInAction; @@ -176,6 +182,12 @@ void ActionHandler::createActions() menuModelEditor->addAction(exportDiagramCommand); d->exportDiagramAction = exportDiagramCommand->action(); + Core::Command *exportSelectedElementsCommand = registerCommand( + Constants::EXPORT_SELECTED_ELEMENTS, [this]() { exportSelectedElements(); }, d->context, true, + tr("Export Selected Elements...")); + menuModelEditor->addAction(exportSelectedElementsCommand); + d->exportSelectedElementsAction = exportSelectedElementsCommand->action(); + menuModelEditor->addSeparator(d->context); Core::Command *zoomInCommand = registerCommand( @@ -304,7 +316,14 @@ void ActionHandler::exportDiagram() { auto editor = qobject_cast<ModelEditor *>(Core::EditorManager::currentEditor()); if (editor) - editor->exportDiagram(); + editor->exportDiagram(false); +} + +void ActionHandler::exportSelectedElements() +{ + auto editor = qobject_cast<ModelEditor *>(Core::EditorManager::currentEditor()); + if (editor) + editor->exportDiagram(true); } void ActionHandler::zoomIn() |