summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-03-09 10:30:41 +0100
committerEike Ziller <eike.ziller@qt.io>2020-03-17 09:39:37 +0000
commited5e6a499954765548aa674fbfbe4159cfabef89 (patch)
treef0edd4d4edeb90a9350d5b55233d832639805766 /src
parent0ff5bf75e16f1383967405ad34628a38d6c60768 (diff)
downloadqt-creator-ed5e6a499954765548aa674fbfbe4159cfabef89.tar.gz
Add some additional shortcuts for actions
Add Cmd+Shift+- for decreasing font size on macOS. Do not add Cmd+= for increasing size, because it conflicts with the existing shortcut for "Replace and Find Next". Sprinkle some Backspace shortcuts in addition to Delete for removing items. There are (laptop) keyboards that either do not have a designated Delete key (requiring Fn+Backspace) or where the Delete key is not conveniently located/sized, and there is no benefit in making the distinction in that case anyhow. Fixes: QTCREATORBUG-706 Fixes: QTCREATORBUG-13733 Change-Id: I06274a9810b82800ec6158a883c95d2a7ae2465e Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/libs/advanceddockingsystem/workspaceview.cpp2
-rw-r--r--src/plugins/bookmarks/bookmarkmanager.cpp2
-rw-r--r--src/plugins/coreplugin/mainwindow.cpp5
-rw-r--r--src/plugins/debugger/breakhandler.cpp4
-rw-r--r--src/plugins/debugger/enginemanager.cpp2
-rw-r--r--src/plugins/debugger/watchhandler.cpp3
-rw-r--r--src/plugins/help/docsettingspage.cpp1
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp4
-rw-r--r--src/plugins/projectexplorer/removetaskhandler.cpp2
-rw-r--r--src/plugins/projectexplorer/sessionview.cpp2
-rw-r--r--src/plugins/qmakeprojectmanager/customwidgetwizard/classlist.cpp1
-rw-r--r--src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp10
-rw-r--r--src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h1
-rw-r--r--src/plugins/qmldesigner/shortcutmanager.cpp7
-rw-r--r--src/plugins/resourceeditor/qrceditor/resourceview.cpp2
-rw-r--r--src/plugins/scxmleditor/common/structure.cpp2
-rw-r--r--src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp2
-rw-r--r--src/plugins/scxmleditor/plugin_interface/transitionitem.cpp2
-rw-r--r--src/plugins/valgrind/memcheckerrorview.cpp2
-rw-r--r--src/shared/help/bookmarkmanager.cpp3
20 files changed, 30 insertions, 29 deletions
diff --git a/src/libs/advanceddockingsystem/workspaceview.cpp b/src/libs/advanceddockingsystem/workspaceview.cpp
index 383aa2d0a5..087fc056af 100644
--- a/src/libs/advanceddockingsystem/workspaceview.cpp
+++ b/src/libs/advanceddockingsystem/workspaceview.cpp
@@ -187,7 +187,7 @@ void WorkspaceView::showEvent(QShowEvent *event)
void WorkspaceView::keyPressEvent(QKeyEvent *event)
{
- if (event->key() != Qt::Key_Delete) {
+ if (event->key() != Qt::Key_Delete && event->key() != Qt::Key_Backspace) {
TreeView::keyPressEvent(event);
return;
}
diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp
index f4147f02a3..7c1854ff29 100644
--- a/src/plugins/bookmarks/bookmarkmanager.cpp
+++ b/src/plugins/bookmarks/bookmarkmanager.cpp
@@ -274,7 +274,7 @@ void BookmarkView::removeBookmark(const QModelIndex& index)
void BookmarkView::keyPressEvent(QKeyEvent *event)
{
- if (event->key() == Qt::Key_Delete) {
+ if (event->key() == Qt::Key_Delete || event->key() == Qt::Key_Backspace) {
removeBookmark(currentIndex());
event->accept();
return;
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp
index 67a3e80635..929d498827 100644
--- a/src/plugins/coreplugin/mainwindow.cpp
+++ b/src/plugins/coreplugin/mainwindow.cpp
@@ -645,7 +645,10 @@ void MainWindow::registerDefaultActions()
: Utils::Icons::ZOOMOUT_TOOLBAR.icon();
tmpaction = new QAction(icon, tr("Zoom Out"), this);
cmd = ActionManager::registerAction(tmpaction, Constants::ZOOM_OUT);
- cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+-")));
+ if (useMacShortcuts)
+ cmd->setDefaultKeySequences({QKeySequence(tr("Ctrl+-")), QKeySequence(tr("Ctrl+Shift+-"))});
+ else
+ cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+-")));
tmpaction->setEnabled(false);
// Zoom Reset Action
diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index ae840e772c..930f63bf4f 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -1509,7 +1509,7 @@ bool BreakHandler::setData(const QModelIndex &idx, const QVariant &value, int ro
return contextMenuEvent(ev);
if (auto kev = ev.as<QKeyEvent>(QEvent::KeyPress)) {
- if (kev->key() == Qt::Key_Delete) {
+ if (kev->key() == Qt::Key_Delete || kev->key() == Qt::Key_Backspace) {
QModelIndexList si = ev.currentOrSelectedRows();
const Breakpoints bps = findBreakpointsByIndex(si);
for (Breakpoint bp : bps) {
@@ -2547,7 +2547,7 @@ bool BreakpointManager::setData(const QModelIndex &idx, const QVariant &value, i
return contextMenuEvent(ev);
if (auto kev = ev.as<QKeyEvent>(QEvent::KeyPress)) {
- if (kev->key() == Qt::Key_Delete) {
+ if (kev->key() == Qt::Key_Delete || kev->key() == Qt::Key_Backspace) {
QModelIndexList si = ev.currentOrSelectedRows();
const GlobalBreakpoints gbps = findBreakpointsByIndex(si);
for (GlobalBreakpoint gbp : gbps)
diff --git a/src/plugins/debugger/enginemanager.cpp b/src/plugins/debugger/enginemanager.cpp
index 8c2bbca146..1770758b11 100644
--- a/src/plugins/debugger/enginemanager.cpp
+++ b/src/plugins/debugger/enginemanager.cpp
@@ -310,7 +310,7 @@ bool EngineItem::setData(int row, const QVariant &value, int role)
}
if (auto kev = ev.as<QKeyEvent>(QEvent::KeyPress)) {
- if (kev->key() == Qt::Key_Delete && m_engine) {
+ if ((kev->key() == Qt::Key_Delete || kev->key() == Qt::Key_Backspace) && m_engine) {
m_engine->quitDebugger();
} else if (kev->key() == Qt::Key_Return || kev->key() == Qt::Key_Enter) {
d->activateEngineByIndex(row);
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index 066f9be23b..9aac88f9e3 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -1108,7 +1108,8 @@ bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role
}
if (auto kev = ev.as<QKeyEvent>(QEvent::KeyPress)) {
- if (item && kev->key() == Qt::Key_Delete && item->isWatcher()) {
+ if (item && (kev->key() == Qt::Key_Delete || kev->key() == Qt::Key_Backspace)
+ && item->isWatcher()) {
foreach (const QModelIndex &idx, ev.selectedRows())
removeWatchItem(itemForIndex(idx));
return true;
diff --git a/src/plugins/help/docsettingspage.cpp b/src/plugins/help/docsettingspage.cpp
index dca464a462..efb9b8a625 100644
--- a/src/plugins/help/docsettingspage.cpp
+++ b/src/plugins/help/docsettingspage.cpp
@@ -282,6 +282,7 @@ bool DocSettingsPageWidget::eventFilter(QObject *object, QEvent *event)
if (event->type() == QEvent::KeyPress) {
auto ke = static_cast<const QKeyEvent*>(event);
switch (ke->key()) {
+ case Qt::Key_Backspace:
case Qt::Key_Delete:
removeDocumentation(currentSelection());
break;
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 8791ae69ed..440acf9cf0 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -1362,7 +1362,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
dd->m_removeFileAction = new QAction(this);
cmd = ActionManager::registerAction(dd->m_removeFileAction, Constants::REMOVEFILE,
projectTreeContext);
- cmd->setDefaultKeySequence(QKeySequence::Delete);
+ cmd->setDefaultKeySequences({QKeySequence::Delete, QKeySequence::Backspace});
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
// duplicate file action
@@ -1381,7 +1381,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
dd->m_deleteFileAction = new QAction(tr("Delete File..."), this);
cmd = ActionManager::registerAction(dd->m_deleteFileAction, Constants::DELETEFILE,
projectTreeContext);
- cmd->setDefaultKeySequence(QKeySequence::Delete);
+ cmd->setDefaultKeySequences({QKeySequence::Delete, QKeySequence::Backspace});
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
// renamefile action
diff --git a/src/plugins/projectexplorer/removetaskhandler.cpp b/src/plugins/projectexplorer/removetaskhandler.cpp
index b71b9b0556..b8abc22e11 100644
--- a/src/plugins/projectexplorer/removetaskhandler.cpp
+++ b/src/plugins/projectexplorer/removetaskhandler.cpp
@@ -42,7 +42,7 @@ QAction *RemoveTaskHandler::createAction(QObject *parent) const
{
QAction *removeAction = new QAction(tr("Remove", "Name of the action triggering the removetaskhandler"), parent);
removeAction->setToolTip(tr("Remove task from the task list."));
- removeAction->setShortcut(QKeySequence(QKeySequence::Delete));
+ removeAction->setShortcuts({QKeySequence::Delete, QKeySequence::Backspace});
removeAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
return removeAction;
}
diff --git a/src/plugins/projectexplorer/sessionview.cpp b/src/plugins/projectexplorer/sessionview.cpp
index ab92ce16b8..49cd8b1486 100644
--- a/src/plugins/projectexplorer/sessionview.cpp
+++ b/src/plugins/projectexplorer/sessionview.cpp
@@ -152,7 +152,7 @@ void SessionView::showEvent(QShowEvent *event)
void SessionView::keyPressEvent(QKeyEvent *event)
{
- if (event->key() != Qt::Key_Delete) {
+ if (event->key() != Qt::Key_Delete && event->key() != Qt::Key_Backspace) {
TreeView::keyPressEvent(event);
return;
}
diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/classlist.cpp b/src/plugins/qmakeprojectmanager/customwidgetwizard/classlist.cpp
index 6c6a3ad7c6..1dcca7754c 100644
--- a/src/plugins/qmakeprojectmanager/customwidgetwizard/classlist.cpp
+++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/classlist.cpp
@@ -147,6 +147,7 @@ void ClassList::removeCurrentClass()
void ClassList::keyPressEvent(QKeyEvent *event)
{
switch (event->key()) {
+ case Qt::Key_Backspace:
case Qt::Key_Delete:
removeCurrentClass();
break;
diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp
index ae4532f1f1..1163af6c58 100644
--- a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp
+++ b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp
@@ -58,7 +58,6 @@ ConnectionViewWidget::ConnectionViewWidget(QWidget *parent) :
ui(new Ui::ConnectionViewWidget)
{
m_actionEditor = new QmlDesigner::ActionEditor(this);
- m_deleteShortcut = new QShortcut(this);
QObject::connect(m_actionEditor, &QmlDesigner::ActionEditor::accepted,
[&]() {
if (m_actionEditor->hasModelIndex()) {
@@ -125,7 +124,6 @@ ConnectionViewWidget::~ConnectionViewWidget()
{
delete m_actionEditor;
delete ui;
- delete m_deleteShortcut;
}
void ConnectionViewWidget::setBindingModel(BindingModel *model)
@@ -215,9 +213,11 @@ QList<QToolButton *> ConnectionViewWidget::createToolBarWidgets()
connect(buttons.constLast(), &QAbstractButton::clicked, this, &ConnectionViewWidget::removeButtonClicked);
connect(this, &ConnectionViewWidget::setEnabledRemoveButton, buttons.constLast(), &QWidget::setEnabled);
- m_deleteShortcut->setKey(Qt::Key_Delete);
- m_deleteShortcut->setContext(Qt::WidgetWithChildrenShortcut);
- connect(m_deleteShortcut, &QShortcut::activated, this, &ConnectionViewWidget::removeButtonClicked);
+ QAction *deleteShortcut = new QAction(this);
+ this->addAction(deleteShortcut);
+ deleteShortcut->setShortcuts({QKeySequence::Delete, QKeySequence::Backspace});
+ deleteShortcut->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+ connect(deleteShortcut, &QAction::triggered, this, &ConnectionViewWidget::removeButtonClicked);
return buttons;
}
diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h
index c1f1271fca..d69d0de280 100644
--- a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h
+++ b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h
@@ -102,7 +102,6 @@ private:
private:
Ui::ConnectionViewWidget *ui;
QmlDesigner::ActionEditor *m_actionEditor;
- QShortcut *m_deleteShortcut;
};
} // namespace Internal
diff --git a/src/plugins/qmldesigner/shortcutmanager.cpp b/src/plugins/qmldesigner/shortcutmanager.cpp
index 1ae2ef1481..617c1775ab 100644
--- a/src/plugins/qmldesigner/shortcutmanager.cpp
+++ b/src/plugins/qmldesigner/shortcutmanager.cpp
@@ -154,12 +154,7 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
m_deleteAction.setIcon(QIcon::fromTheme(QLatin1String("edit-cut"), Utils::Icons::EDIT_CLEAR_TOOLBAR.icon()));
command = Core::ActionManager::registerAction(&m_deleteAction, QmlDesigner::Constants::C_DELETE, qmlDesignerMainContext);
- if (Utils::HostOsInfo::isMacHost())
- command->setDefaultKeySequence(QKeySequence::Backspace);
- else
- command->setDefaultKeySequence(QKeySequence::Delete);
-
- Utils::HostOsInfo::isMacHost() ;
+ command->setDefaultKeySequences({QKeySequence::Delete, QKeySequence::Backspace});
command->setAttribute(Core::Command::CA_Hide); // don't show delete in other modes
if (!Utils::HostOsInfo::isMacHost())
diff --git a/src/plugins/resourceeditor/qrceditor/resourceview.cpp b/src/plugins/resourceeditor/qrceditor/resourceview.cpp
index 8e2c70ad79..1fc524bf28 100644
--- a/src/plugins/resourceeditor/qrceditor/resourceview.cpp
+++ b/src/plugins/resourceeditor/qrceditor/resourceview.cpp
@@ -175,7 +175,7 @@ void ResourceView::removeFiles(int prefixIndex, int firstFileIndex, int lastFile
void ResourceView::keyPressEvent(QKeyEvent *e)
{
- if (e->key() == Qt::Key_Delete)
+ if (e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace)
emit removeItem();
else
Utils::TreeView::keyPressEvent(e);
diff --git a/src/plugins/scxmleditor/common/structure.cpp b/src/plugins/scxmleditor/common/structure.cpp
index be49e9711d..08164e0aa3 100644
--- a/src/plugins/scxmleditor/common/structure.cpp
+++ b/src/plugins/scxmleditor/common/structure.cpp
@@ -239,7 +239,7 @@ void Structure::childAdded(const QModelIndex &childIndex)
void Structure::keyPressEvent(QKeyEvent *e)
{
- if (e->key() == Qt::Key_Delete) {
+ if (e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace) {
QModelIndex ind = m_proxyModel->mapToSource(m_structureView->currentIndex());
auto tag = static_cast<ScxmlTag*>(ind.internalPointer());
if (tag && m_currentDocument) {
diff --git a/src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp b/src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp
index 5513ed1ee7..863b40ae0c 100644
--- a/src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp
@@ -679,7 +679,7 @@ void GraphicsScene::keyPressEvent(QKeyEvent *event)
{
QGraphicsItem *focusItem = this->focusItem();
if (!focusItem || focusItem->type() != TextType) {
- if (event->key() == Qt::Key_Delete)
+ if (event->key() == Qt::Key_Delete || event->key() == Qt::Key_Backspace)
removeSelectedItems();
}
QGraphicsScene::keyPressEvent(event);
diff --git a/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp b/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp
index e388a43cc8..fb0c5743ab 100644
--- a/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp
@@ -457,7 +457,7 @@ void TransitionItem::selectedMenuAction(const QAction *action)
void TransitionItem::keyPressEvent(QKeyEvent *event)
{
- if (event->key() == Qt::Key_Delete) {
+ if (event->key() == Qt::Key_Delete || event->key() == Qt::Key_Backspace) {
bool bFound = false;
if (m_cornerGrabbers.count() > 2) {
for (int i = m_cornerGrabbers.count() - 1; i >= 1; i--) {
diff --git a/src/plugins/valgrind/memcheckerrorview.cpp b/src/plugins/valgrind/memcheckerrorview.cpp
index 3dfa939ddd..0e45b76d43 100644
--- a/src/plugins/valgrind/memcheckerrorview.cpp
+++ b/src/plugins/valgrind/memcheckerrorview.cpp
@@ -61,7 +61,7 @@ MemcheckErrorView::MemcheckErrorView(QWidget *parent)
{":/valgrind/images/suppressoverlay.png", Utils::Theme::IconsErrorColor}},
Utils::Icon::Tint | Utils::Icon::PunchEdges).icon();
m_suppressAction->setIcon(icon);
- m_suppressAction->setShortcut(QKeySequence(Qt::Key_Delete));
+ m_suppressAction->setShortcuts({QKeySequence::Delete, QKeySequence::Backspace});
m_suppressAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
connect(m_suppressAction, &QAction::triggered, this, &MemcheckErrorView::suppressError);
addAction(m_suppressAction);
diff --git a/src/shared/help/bookmarkmanager.cpp b/src/shared/help/bookmarkmanager.cpp
index c067334d4c..e67f910e9c 100644
--- a/src/shared/help/bookmarkmanager.cpp
+++ b/src/shared/help/bookmarkmanager.cpp
@@ -273,6 +273,7 @@ bool BookmarkDialog::eventFilter(QObject *object, QEvent *e)
}
} break;
+ case Qt::Key_Backspace:
case Qt::Key_Delete: {
bookmarkManager->removeBookmarkItem(ui.treeView,
proxyModel->mapToSource(index));
@@ -489,7 +490,7 @@ bool BookmarkWidget::eventFilter(QObject *object, QEvent *e)
treeView->edit(index);
item->setEditable(false);
}
- } else if (ke->key() == Qt::Key_Delete) {
+ } else if (ke->key() == Qt::Key_Delete || ke->key() == Qt::Key_Backspace) {
bookmarkManager->removeBookmarkItem(treeView, src);
}
}