-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Command + Backspace as the shortcut to delete torrents on macOS #20668
Conversation
@@ -857,6 +857,7 @@ void MainWindow::createKeyboardShortcuts() | |||
m_ui->actionExit->setShortcut(Qt::CTRL | Qt::Key_Q); | |||
#ifdef Q_OS_MACOS | |||
m_ui->actionCloseWindow->setShortcut(QKeySequence::Close); | |||
m_ui->actionDelete->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Backspace)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove redundant cast:
m_ui->actionDelete->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Backspace)); | |
m_ui->actionDelete->setShortcut(Qt::CTRL | Qt::Key_Backspace); |
Also shouldn't you use QAction::setShortcuts
? otherwise you'll override line 854.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this code style be approved? Or should it be called separately?
m_ui->actionDelete->setShortcut(
#ifdef Q_OS_MACOS
Qt::CTRL | Qt::Key_Backspace
#else
QKeySequence::Delete
#endif
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this code style be approved?
I wouldn't use it if there are other ways. Besides that code is still overriding QKeySequence::Delete
. Qt::CTRL | Qt::Key_Backspace
should be additional to QKeySequence::Delete
. They are not mutually exclusive.
Would the following work? Are you able to confirm it?
m_ui->actionDelete->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Backspace)); | |
m_ui->actionDelete->setShortcuts(Qt::CTRL | Qt::Key_Backspace); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setShortcuts(Qt::CTRL | Qt::Key_Backspace) works. Following your suggestion, I pushed a new commit.
This PR is stale because it has been 60 days with no activity. This PR will be automatically closed within 7 days if there is no further activity. |
This PR was closed because it has been stalled for some time with no activity. |
macOS usually uses the Command key plus another key as shortcuts, similar to qBittorrent's other shortcuts.
Closes #20187.