Commit 21566e5b authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner: Use backspace to delete items on Mac OS X



On all platforms backspace will delete the selected item(s),
but on Mac OS X the backspace key will be shown as the shortcut
in the menu.

Just creating the QAction did nothing.

Task-number: QTCREATORBUG-10658
Change-Id: I476ee8bd6b03dd7453cbfa1b5814aca9b1c0634d
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent ffec753e
......@@ -33,6 +33,7 @@
namespace QmlDesigner {
namespace Constants {
const char C_BACKSPACE[] = "QmlDesigner.Backspace";
const char C_DELETE[] = "QmlDesigner.Delete";
// Context
......
......@@ -115,11 +115,19 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
//Edit Menu
command = Core::ActionManager::registerAction(&m_deleteAction, QmlDesigner::Constants::C_BACKSPACE, qmlDesignerFormEditorContext);
command = Core::ActionManager::registerAction(&m_deleteAction, QmlDesigner::Constants::C_BACKSPACE, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence(Qt::Key_Backspace));
command->setAttribute(Core::Command::CA_Hide); // don't show delete in other modes
if (Utils::HostOsInfo::isMacHost())
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
command = Core::ActionManager::registerAction(&m_deleteAction, QmlDesigner::Constants::C_DELETE, qmlDesignerFormEditorContext);
command = Core::ActionManager::registerAction(&m_deleteAction, QmlDesigner::Constants::C_DELETE, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence::Delete);
command->setAttribute(Core::Command::CA_Hide); // don't show delete in other modes
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
if (!Utils::HostOsInfo::isMacHost())
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
command = Core::ActionManager::registerAction(&m_cutAction, Core::Constants::CUT, qmlDesignerFormEditorContext);
command = Core::ActionManager::registerAction(&m_cutAction, Core::Constants::CUT, qmlDesignerNavigatorContext);
......@@ -159,16 +167,6 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
viewsMenu->addAction(command);
command = Core::ActionManager::registerAction(&m_hideSidebarsAction, Core::Constants::TOGGLE_SIDEBAR, qmlDesignerMainContext);
if (Utils::HostOsInfo::isMacHost()) {
// add second shortcut to trigger delete
QAction *deleteAction = new QAction(this);
deleteAction->setShortcut(QKeySequence(QLatin1String("Backspace")));
connect(deleteAction,
SIGNAL(triggered()),
&m_deleteAction,
SIGNAL(triggered()));
}
}
void ShortCutManager::updateActions(Core::IEditor* currentEditor)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment