aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/modeleditor/actionhandler.cpp
diff options
context:
space:
mode:
authorJochen Becher <jochen_becher@gmx.de>2015-12-27 16:19:33 +0100
committerJochen Becher <jochen_becher@gmx.de>2016-01-06 10:41:37 +0000
commit57ceb1569221d4f10aedb853b03e838ef95063f8 (patch)
tree3e1b281173b83d5e65dc688edab6d712977f009c /src/plugins/modeleditor/actionhandler.cpp
parent83368083d1f83d77899dc006a5103feac933bd08 (diff)
ModelEditor: Add action for inplace editing
Pressing "Return" activates inplace editing, Shift+Return activates properties. Change-Id: I67601a439d27f9d322a3a88f7706d26f75faaab8 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Diffstat (limited to 'src/plugins/modeleditor/actionhandler.cpp')
-rw-r--r--src/plugins/modeleditor/actionhandler.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/plugins/modeleditor/actionhandler.cpp b/src/plugins/modeleditor/actionhandler.cpp
index 284a1503ec..f5796b3ada 100644
--- a/src/plugins/modeleditor/actionhandler.cpp
+++ b/src/plugins/modeleditor/actionhandler.cpp
@@ -144,15 +144,18 @@ void ActionHandler::createActions()
registerCommand(Constants::ACTION_ADD_COMPONENT, nullptr, Core::Context());
registerCommand(Constants::ACTION_ADD_CLASS, nullptr, Core::Context());
registerCommand(Constants::ACTION_ADD_CANVAS_DIAGRAM, nullptr, Core::Context());
-}
-void ActionHandler::createEditPropertiesShortcut(const Core::Id &shortcutId)
-{
- auto editAction = new QAction(tr("Edit Element Properties"), Core::ICore::mainWindow());
- Core::Command *editCommand = Core::ActionManager::registerAction(
- editAction, shortcutId, d->context);
- editCommand->setDefaultKeySequence(QKeySequence(tr("Return")));
- connect(editAction, &QAction::triggered, this, &ActionHandler::onEditProperties);
+ auto editPropertiesAction = new QAction(tr("Edit Element Properties"), Core::ICore::mainWindow());
+ Core::Command *editPropertiesCommand = Core::ActionManager::registerAction(
+ editPropertiesAction, Constants::SHORTCUT_MODEL_EDITOR_EDIT_PROPERTIES, d->context);
+ editPropertiesCommand->setDefaultKeySequence(QKeySequence(tr("Shift+Return")));
+ connect(editPropertiesAction, &QAction::triggered, this, &ActionHandler::onEditProperties);
+
+ auto editItemAction = new QAction(tr("Edit Item on Diagram"), Core::ICore::mainWindow());
+ Core::Command *editItemCommand = Core::ActionManager::registerAction(
+ editItemAction, Constants::SHORTCUT_MODEL_EDITOR_EDIT_ITEM, d->context);
+ editItemCommand->setDefaultKeySequence(QKeySequence(tr("Return")));
+ connect(editItemAction, &QAction::triggered, this, &ActionHandler::onEditItem);
}
void ActionHandler::undo()
@@ -225,6 +228,13 @@ void ActionHandler::onEditProperties()
editor->editProperties();
}
+void ActionHandler::onEditItem()
+{
+ auto editor = qobject_cast<ModelEditor *>(Core::EditorManager::currentEditor());
+ if (editor)
+ editor->editSelectedItem();
+}
+
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)