From 42386dbdbcda06f192f61605111e3ea4e186a283 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 16 Apr 2018 14:10:14 +0200 Subject: [PATCH] QmlDesigner/ShortcutManager: Cleanup Remove some unneeded 0-parents, use nullptr, and do not use parameter actions when they are not needed. Change-Id: Ia556f83f7f1ce296fc08fa76cced7f41102d110f Reviewed-by: Thomas Hartmann --- src/plugins/qmldesigner/shortcutmanager.cpp | 36 +++++++++------------ src/plugins/qmldesigner/shortcutmanager.h | 11 +++---- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/src/plugins/qmldesigner/shortcutmanager.cpp b/src/plugins/qmldesigner/shortcutmanager.cpp index fe5b640210f..9bb8574b282 100644 --- a/src/plugins/qmldesigner/shortcutmanager.cpp +++ b/src/plugins/qmldesigner/shortcutmanager.cpp @@ -63,25 +63,19 @@ namespace QmlDesigner { ShortCutManager::ShortCutManager() : QObject(), - m_revertToSavedAction(0), - m_saveAction(0), - m_saveAsAction(0), - m_exportAsImageAction(tr("Export as &Image..."), 0), - m_closeCurrentEditorAction(0), - m_closeAllEditorsAction(0), - m_closeOtherEditorsAction(0), - m_undoAction(tr("&Undo"), 0), - m_redoAction(tr("&Redo"), 0), - m_deleteAction(tr("Delete"), tr("Delete \"%1\""), Utils::ParameterAction::EnabledWithParameter), - m_cutAction(tr("Cu&t"), tr("Cut \"%1\""), Utils::ParameterAction::EnabledWithParameter), - m_copyAction(tr("&Copy"), tr("Copy \"%1\""), Utils::ParameterAction::EnabledWithParameter), - m_pasteAction(tr("&Paste"), tr("Paste \"%1\""), Utils::ParameterAction::EnabledWithParameter), - m_selectAllAction(tr("Select &All"), tr("Select All \"%1\""), Utils::ParameterAction::EnabledWithParameter), - m_collapseExpandStatesAction(tr("Toggle States"), 0), - m_restoreDefaultViewAction(tr("&Restore Default View"), 0), - m_toggleLeftSidebarAction(tr("Toggle &Left Sidebar"), 0), - m_toggleRightSidebarAction(tr("Toggle &Right Sidebar"), 0), - m_switchTextFormAction(tr("Switch Text/Design"), 0), + m_exportAsImageAction(tr("Export as &Image...")), + m_undoAction(tr("&Undo")), + m_redoAction(tr("&Redo")), + m_deleteAction(tr("Delete")), + m_cutAction(tr("Cu&t")), + m_copyAction(tr("&Copy")), + m_pasteAction(tr("&Paste")), + m_selectAllAction(tr("Select &All")), + m_collapseExpandStatesAction(tr("Toggle States")), + m_restoreDefaultViewAction(tr("&Restore Default View")), + m_toggleLeftSidebarAction(tr("Toggle &Left Sidebar")), + m_toggleRightSidebarAction(tr("Toggle &Right Sidebar")), + m_switchTextFormAction(tr("Switch Text/Design")), m_escapeAction(this) { @@ -261,7 +255,7 @@ void ShortCutManager::updateActions(Core::IEditor* currentEditor) { int openedCount = Core::DocumentModel::entryCount(); - Core::IDocument *document = 0; + Core::IDocument *document = nullptr; if (currentEditor) document = currentEditor->document(); m_saveAction.setEnabled(document && document->isModified()); @@ -278,7 +272,7 @@ void ShortCutManager::updateActions(Core::IEditor* currentEditor) m_saveAction.setText(tr("&Save %1").arg(quotedName)); m_revertToSavedAction.setText(tr("Revert %1 to Saved").arg(quotedName)); - m_closeCurrentEditorAction.setEnabled(currentEditor != 0); + m_closeCurrentEditorAction.setEnabled(currentEditor != nullptr); m_closeCurrentEditorAction.setText(tr("Close %1").arg(quotedName)); m_closeAllEditorsAction.setEnabled(openedCount > 0); m_closeOtherEditorsAction.setEnabled(openedCount > 1); diff --git a/src/plugins/qmldesigner/shortcutmanager.h b/src/plugins/qmldesigner/shortcutmanager.h index 3c3999b2a7f..2d80520a4e7 100644 --- a/src/plugins/qmldesigner/shortcutmanager.h +++ b/src/plugins/qmldesigner/shortcutmanager.h @@ -27,7 +27,6 @@ #include #include -#include namespace Core { class IEditor; @@ -80,11 +79,11 @@ private: QAction m_closeOtherEditorsAction; QAction m_undoAction; QAction m_redoAction; - Utils::ParameterAction m_deleteAction; - Utils::ParameterAction m_cutAction; - Utils::ParameterAction m_copyAction; - Utils::ParameterAction m_pasteAction; - Utils::ParameterAction m_selectAllAction; + QAction m_deleteAction; + QAction m_cutAction; + QAction m_copyAction; + QAction m_pasteAction; + QAction m_selectAllAction; QAction m_collapseExpandStatesAction; QAction m_restoreDefaultViewAction; QAction m_toggleLeftSidebarAction;