-
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
Implemented Shortcut to cycle open tabs #24184
base: master
Are you sure you want to change the base?
Implemented Shortcut to cycle open tabs #24184
Conversation
@@ -92,6 +92,51 @@ | |||
<key>nav-escape</key> | |||
<seq>Esc</seq> | |||
</SC> | |||
<SC> | |||
<key>next-tab</key> | |||
<seq>Ctrl+Tab</seq> |
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.
On macOS, it needs to be Meta
instead of Ctrl
.
For macOS, Qt namely automatically translates Ctrl
to Cmd
, and Cmd
+Tab
and Cmd
+Shift
+Tab
are reserved system shortcuts.
For in-app tab switching, most macOS apps use the actual Ctrl
key, and to get this with Qt, you need to write Meta
.
dispatcher()->reg(this, "eighth-tab", [this]() { navigateToSpecificTab("eighth-tab"); }); | ||
dispatcher()->reg(this, "last-tab", [this]() { navigateToSpecificTab("last-tab"); }); |
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.
I would alter the navigateToSpecificTab
method to take an int index
rather than an action code.
Inside that method, you would need to do some sanity checks. (if (index < 0 || index >= m_notations.size()) { return; }
And here, you would need to write the index instead of the action code. Shouldn't be complicated though, for example these last two lines might become
dispatcher()->reg(this, "eighth-tab", [this]() { navigateToSpecificTab("eighth-tab"); }); | |
dispatcher()->reg(this, "last-tab", [this]() { navigateToSpecificTab("last-tab"); }); | |
dispatcher()->reg(this, "eighth-tab", [this]() { navigateToSpecificTab(7); }); | |
dispatcher()->reg(this, "last-tab", [this]() { navigateToSpecificTab(m_notations.size() - 1); }); |
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.
Updated.
See #23702 (comment):
|
|
It's not a key sequence. When you press Shift+Tab from the score it puts focus on the tab bar: Now the program is in a different "context" and we can listen for a different set of shortcuts. For example, press 'B' and it should focus the Bb Clarinet tab. Quickly press 'A' (or just press 'B' again) and it should put focus on the Bassoon tab. Press Space or Enter to load this tab (possibly press Tab) and then we're back in the Score context again. (This score is the Wind Quartet template from the New Score dialog.) |
Ah, I see, so you mean like #16508. That should probably be implemented just in QML, bypassing the keyboard shortcuts system, so this shouldn't be affected by contexts. But it might be better to save that for a different PR. |
Should this be implemented for all QML dropdowns, menus, lists, and treeviews, or just for tab bar? I'm happy to work on it but would appreciate some guidance on implementation. |
@shubham-shinde-442, it should be implemented for all of them except menus for the time being because it will interfere with Alt+letter mnemonics, so we need to decide what to do about that. (One option is to force people to keep holding the Alt key if they want to use mnemonics, but that might be unpopular. In Microsoft apps you can release Alt before you use a sequence of letters to navigate through a menu: It should also be implemented for controls within a navigation panel, such as button in a toolbar. If you're in the note input toolbar and you press 'Q' it should focus the "Quarter note" button. If there's an opportunity to share code rather than copy-pasting then it should be taken. If not then it can be split across several PRs, one for tab bars, one for dropdowns, one for lists, etc. I've updated the description in #16508 with more details. See PR #5829 for a previous implementation in MuseScore 3. I'm on vacation for the next 3 weeks so my capacity to help is limited, but I'm happy to test PR builds. |
Resolves: #23702
Shortcut to cycle open tabs.