strawberrymusicplayer / strawberry

:strawberry: Strawberry Music Player
https://www.strawberrymusicplayer.org/
GNU General Public License v3.0
2.54k stars 165 forks source link

Mouse Scroll Wheel Unexpectedly Modifies Dropdown Values in Settings Window #1380

Closed illtellyoulater closed 4 months ago

illtellyoulater commented 4 months ago

Describe the bug While navigating the settings window in Strawberry Music Player, using the mouse scroll wheel over dropdown menus unexpectedly modifies their values without any user input other than scrolling. This behavior diverges from the standard UI practices seen in most operating systems, where scrolling over a dropdown menu does not change its value unless the menu is actively expanded. This can lead to unintentional settings changes by the user.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Settings' in the Strawberry Music Player.
  2. Hover the mouse cursor over any dropdown menu within the various settings subsections.
  3. Use the mouse scroll wheel to navigate through the settings.
  4. Observe that the value of the dropdown menu changes as the mouse wheel scrolls over it.

Expected behavior The expected behavior is that scrolling over a dropdown menu should not change its value unless the menu is actively selected and expanded. This would prevent unintentional changes to settings by merely scrolling through the options.

System Information:

Additional context This issue may lead to a frustrating user experience, as changes could be made without direct awareness, possibly affecting the application's performance or behavior unexpectedly.

jonaski commented 4 months ago

I agree with you, but it's the default behavior of QComboBox in Qt, changing it is not just changing a property, we need to create custom combobox and override the scroll event, if it wasn't for that, it would have been done a long time ago. But it might be worth doing anyway, the behavior is annoying.

illtellyoulater commented 4 months ago

Sure, let's see if I can help; I asked ChatGPT 4 to make an online search to see if anyone might have already addressed this, here's the answer:

Several approaches have been discussed and implemented by the Qt community to address the issue of disabling mouse wheel events on QComboBox widgets to prevent unintended value changes. Here are the summarized strategies from the forums:

  1. Event Filter Method: You can install an event filter on the QComboBox. In the event filter, check if the event is a wheel event and simply return true to indicate that the event has been handled, effectively blocking it. This approach was detailed in the Qt Forum and Qt Centre discussions, demonstrating how to intercept and block wheel events specifically for combo boxes without requiring subclassing of the widget itself. This method involves overriding the eventFilter method in your class that contains the QComboBox and installing the event filter on the QComboBox instance.

  2. Custom Subclassing Method: Another method involves subclassing QComboBox and overriding the wheelEvent method. Within this method, you can include a condition to only call the base class's wheelEvent method if the combo box currently has focus. This ensures that wheel events will only affect the combo box when it is explicitly focused, avoiding unintended value changes when scrolling over it. This approach requires a bit more code but offers more control over the behavior of the combo box.

Both strategies are aimed at enhancing user experience by ensuring that combo box values cannot be changed unintentionally through scroll wheel actions, especially when the combo box is not the current focus of the application.

For implementing these solutions, the key is to intercept the wheel event and decide whether to propagate it to the QComboBox based on the widget's focus state. These solutions provide a way to customize the behavior of QComboBox in your application to match user expectations and standard UI practices more closely.

References:

These discussions and code examples should provide a solid foundation for addressing the issue in the Strawberry Music Player or any other application using Qt widgets.

illtellyoulater commented 4 months ago

Is this what they mean when they say godspeed? ;) I'm eager to see the change in action! Thank you.

jonaski commented 4 months ago

You can try the latest from https://builds.strawberrymusicplayer.org/ubuntu/jammy/ if you want to test (Jammy should be compatible with Pop Os).

illtellyoulater commented 4 months ago

I am currently using the flatpak version. Could you please push the update to that version too?