Skip to content
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

Merged
merged 3 commits into from
Mar 15, 2020

Conversation

sonic2kk
Copy link
Contributor

@sonic2kk sonic2kk commented Feb 26, 2020

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, using QKeySequence::Preferences.

@@ -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) });
Copy link
Member

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?

Copy link
Contributor Author

@sonic2kk sonic2kk Feb 26, 2020

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?

Copy link
Member

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.

Copy link
Contributor Author

@sonic2kk sonic2kk Feb 26, 2020

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 😄

@leoetlino leoetlino merged commit 19a46dd into dolphin-emu:master Mar 15, 2020
@sonic2kk sonic2kk deleted the qtshortcuts branch November 15, 2020 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants