-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Qt: Use Builtin QKeySequence Shortcuts #8652
Conversation
Source/Core/DolphinQt/MenuBar.cpp
Outdated
@@ -212,7 +212,8 @@ void MenuBar::AddFileMenu() | |||
file_menu->addSeparator(); | |||
|
|||
m_exit_action = | |||
file_menu->addAction(tr("E&xit"), this, &MenuBar::Exit, QKeySequence(Qt::ALT + Qt::Key_F4)); | |||
file_menu->addAction(tr("E&xit"), this, &MenuBar::Exit); | |||
m_exit_action->setShortcuts({ QKeySequence::Quit, QKeySequence(Qt::ALT + Qt::Key_F4) }); |
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.
Any reason you didn't use QKeySequence::Quit
for this while you were at it?
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.
It is in use, it uses both QKeySequence::Quit
and the existing Alt+F4 shortcut. Granted, on my system (Arch + KDE Plasma) Alt+F4 still works anyway even without adding both shortcuts. Unless I'm misunderstanding?
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.
Well, yeah, missed the word "just" in there. But now that you mention it, you're right; macOS uses Command+Q instead of Alt+F4 (or something like that).
Can probably leave it like that, forget that I said anything.
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.
macOS does indeed use Command+Q, which this adds support for. It's also common practice for Qt applications to use Ctrl+Q. I'm not sure what it's like on Windows with non-Qt applications, but on Linux a heck of a lot are starting to implement this, both Gtk and Qt alike.
Oh, and I left in the Alt+F4 because it was there already and didn't want to replace too much, just extend functionality 😄
There are a number of shortcuts built into Qt within the
QKeySequence
class. These have shortcuts for a number of different platforms and for Linux, respective desktop environments. This PR replaces the manually set keys with these builtins for opening, finding and quitting. It also adds a shortcut for opening the Configuration pane, usingQKeySequence::Preferences
.