-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Revise librarycontrol // FocusWidget #4618
Conversation
b1504a2
to
63ee935
Compare
Alright, I tested all controls that were touched by this PR, as well as navigating menus and dialogs. |
63ee935
to
ca34bfe
Compare
There seems to be a kind of loop when the Mixxx window receives the focus, resulting in a flashing focus border. |
The rest works nice. Please give a hint when you consider this a ready for merge. |
Not intended at all, and I can't reproduce. Can you describe your scenario and which widget is flashing? |
ca34bfe
to
92fff33
Compare
fwiw, I can't reproduce this either. |
Oh I have just notice that other Qt Apps are affected as well. So this it probably a Qt issue. |
5ed1f3b
to
f87361f
Compare
Please let me know when someone starts a code review. |
f87361f
to
3037d5d
Compare
src/widget/wtracktableview.h
Outdated
@@ -35,7 +34,7 @@ class WTrackTableView : public WLibraryTableView { | |||
bool hasFocus() const override; | |||
void setFocus() override; | |||
void keyPressEvent(QKeyEvent* event) override; | |||
void loadSelectedTrack() override; | |||
void doubleClickSelectedTrack() override; |
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.
We shouldn't name signals like that. Double clicking only works computers with a mouse. It does not work on touchscreens (double tapping), it does not work on controllers (long press?).
How about something like triggerSelectedTrackSecondaryAction()
or something like that?
Note: This is not a code review, feel free to force-push.
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.
Or is this a non-issue because this signal will never be emitted by using a touchscreen or a controller?
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 simply adjusted to the wording in Preferences > Library > Track Double-Click Action so that the connection is clear for developers.
- Controller mappings would use
[Library], GoToItem
- Keyboards: Keyboard: Enter in library is double-click, change Preview shortcuts #4359
- I don't remember testing with a touch screen tbh, no idea how one can interact with the library. Depends on the OS and desktop environment IIRC.
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.
suggestion: activateSelectedTrack
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.
yup, perfect!
3037d5d
to
a60dcad
Compare
Emulated Shift+Tab sent to QApplication::focusWidget() moves the focus, THOUGH it also makes Shift get stuck for this widget. Actually, this wouldn't matter because Shift is released as soon as this widget receives any keyEvent with Qt::NoModifier. Though, [Playlist],selectTrackKnob doesn't use keyEvents, thus using it directly after [Library],MoveFocusBackward would expand the selection... Simply use BackTab key :)
a60dcad
to
98033e6
Compare
For testing without controllers you can put abd1520 on top to have some debug output and skin feedback for FocusWidget. |
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.
LGTM, And works as expected. Thank you.
Great, I'll add the documentation when I'm back home. |
fixup 4f45dbe |
While testing #4465 I was looking for a way to reliably navigate the track menu with a push encoder, and it turned out my
FocusWidget
approach in #4369 is complicated and not extendable to cover menus and dialogs.Here I revise the focus control:
focusChanged
andfocusWindowChanged
signals. These are emitted every time the focused widget changes or when a new window/popup/menu is ready to receive keyboard presses, thus I could remove almost the entire former implementation.updateFocusedWidgetControls()
FocusWidget
type, as well as the respective new state of[Library],focused_widget
.FocusWidget
is now used by a few library controls to trigger context-specific actions -- this andLibraryControl::emitKeyEvent
is now much simpler, faster and less error-prone I reckonUpdated enum values of
[Library],focused_widget
:TESTING
with controller:
Every
[Library]
control should still work as expected.For testing the menu navigation, manually open a context menu or one in the main menu bar, then use
[Library],MoveVertical
to move the selection,[Library],GoToItem
to activate items and confirm dialogs. Or put https://github.com/ronso0/mixxx/tree/open-track-menu-control on top of this branch.It's also possible to handle error messages and some compact dialogs with these controls, too.
without controller:
open developer tools, find
focused_widget
, then click around in the main GUI and watch how the value changes accordingly, see enum above.