QmlDesigner: Hook up states editor expanded state to command

The expanded/collpased state of the states editor is now hooked up to
a Qt Creator command. This means there is a configurable shortcurt
and an entry in the menu under Windows/Views.

Change-Id: Ied993870fe605cfd6651b203986b009620c98f1b
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2017-01-19 09:44:13 +01:00
committed by Tim Jenssen
parent 58e7554f3d
commit d5ac800b90
9 changed files with 35 additions and 0 deletions

View File

@@ -81,6 +81,7 @@ ShortCutManager::ShortCutManager()
m_pasteAction(tr("&Paste"), tr("Paste \"%1\""), Utils::ParameterAction::EnabledWithParameter),
m_selectAllAction(tr("Select &All"), tr("Select All \"%1\""), Utils::ParameterAction::EnabledWithParameter),
m_hideSidebarsAction(tr("Toggle Sidebars"), 0),
m_collapseExpandStatesAction(tr("Toggle States Editor"), 0),
m_restoreDefaultViewAction(tr("&Restore Default View"), 0),
m_toggleLeftSidebarAction(tr("Toggle &Left Sidebar"), 0),
m_toggleRightSidebarAction(tr("Toggle &Right Sidebar"), 0),
@@ -130,6 +131,10 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
QmlDesignerPlugin::instance()->mainWidget(),
SLOT(toggleRightSidebar()));
connect(&m_collapseExpandStatesAction, &QAction::triggered, [] {
QmlDesignerPlugin::instance()->viewManager().toggleStatesViewExpanded();
});
// Revert to saved
Core::EditorManager *em = Core::EditorManager::instance();
Core::ActionManager::registerAction(&m_revertToSavedAction,Core::Constants::REVERTTOSAVED, qmlDesignerMainContext);
@@ -250,6 +255,11 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+Shift+0"));
viewsMenu->addAction(command);
command = Core::ActionManager::registerAction(&m_collapseExpandStatesAction, Constants::TOGGLE_STATES_EDITOR, qmlDesignerMainContext);
command->setAttribute(Core::Command::CA_Hide);
command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+s"));
viewsMenu->addAction(command);
command = Core::ActionManager::registerAction(&m_restoreDefaultViewAction, Constants::RESTORE_DEFAULT_VIEW, qmlDesignerMainContext);
command->setAttribute(Core::Command::CA_Hide);
viewsMenu->addAction(command);