Coder Social home page Coder Social logo

Comments (5)

jonaski avatar jonaski commented on June 26, 2024

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.

from strawberry.

illtellyoulater avatar illtellyoulater commented on June 26, 2024

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.

from strawberry.

illtellyoulater avatar illtellyoulater commented on June 26, 2024

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

from strawberry.

jonaski avatar jonaski commented on June 26, 2024

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

from strawberry.

illtellyoulater avatar illtellyoulater commented on June 26, 2024

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

from strawberry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.