From 02c81ca6cb0b8954bf04d39b61d451fcc6831db9 Mon Sep 17 00:00:00 2001 From: "Matthew J. Milner" Date: Sun, 25 Feb 2024 14:15:19 +0100 Subject: [PATCH] Use num keys for tool selection without ctrl modifier Signed-off-by: Matthew J. Milner --- avogadro/mainwindow.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/avogadro/mainwindow.cpp b/avogadro/mainwindow.cpp index e520f007..6658b466 100644 --- a/avogadro/mainwindow.cpp +++ b/avogadro/mainwindow.cpp @@ -2201,6 +2201,7 @@ void MainWindow::buildTools() std::sort(m_tools.begin(), m_tools.end(), ToolSort); int index = 1; + int shortcutKey = Qt::Key_1; foreach (ToolPlugin* toolPlugin, m_tools) { // Add action to toolbar. toolPlugin->setParent(this); @@ -2208,7 +2209,9 @@ void MainWindow::buildTools() action->setParent(m_toolToolBar); action->setCheckable(true); if (index < 10) - action->setShortcut(QKeySequence(QString("Ctrl+%1").arg(index))); + action->setShortcut(QKeySequence(shortcutKey)); + if (index == 10) + action->setShortcut(QKeySequence(Qt::Key_0)); action->setData(toolPlugin->objectName()); m_toolToolBar->addAction(action); @@ -2218,6 +2221,7 @@ void MainWindow::buildTools() toolPlugin->registerCommands(); ++index; + ++shortcutKey; } // add the fake tooltip method