-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Ui scroll wheel events #1811
Ui scroll wheel events #1811
Conversation
Does this also disable mouse wheel events for changing volume? It looks like it only affects elements in properties windows. Granted, some people might like that you can change volume with the mouse wheel, but we also frequently have complaints about scrolling down a list of meters causing volumes to change. |
It only affects the elements in properties windows. I could look into editing the ones for volume. Should that be a different issue or should it be working on it in the same issue? This was only for the properties window. |
Since the Mantis issue doesn't specify anything about the properties window specifically, I think including it in this PR would be appropriate. |
It should be written directly at the sub-classing code (not where the sub-classed widgets are used). |
@SuslikV I am a bit confused. Would this mean adding event handlers inside the qslider.h and all other widget files itself? I am a bit new to QT so trying to get my head around it. |
I'm reread my message - and you are right, probably I'm wrote something stupid there. I just want to say that the mentioned (in the bug report) possible method is via sub-classing widgets may look like this:
and then using them in OBS instead of here: obs-studio/UI/properties-view.cpp Lines 323 to 325 in a0ead6f
and in some other places if needed. It gives (in the future) the ability to sub-class the objects differently (per platform) and give to them different focus strategy depending on platform, because something may not work for mac/linux or will be solved by Qt exclusively for one platform and so on. In general, keep control over all widgets in one place. |
It should only apply to properties. The behavior to use middle-mouse scroll with widgets is normal operating system behavior. For properties, the reason why this is useful is because it's annoying if you want to scroll through the view itself. |
I am attempting to create a subclass like @SuslikV stated. I am running into issues creating the Qt MOC files I think. I stated it on the discord server. After I get the subclassing to work, I will remove the eventfilter and implement the subclass to the properties |
No, your pull request was fine as-is, outside of the formatting and commit issues. I don't want you to remove scroll wheel events except for how you did it with the properties window. |
@SuslikV scroll wheel events in the background are a normal part of operating system behavior. This happens with other programs too. What @akapar2016 actually did, which was disable wheel events for properties within a properties window in favor of being able to scroll the actual full contents of the properties, was actually a more ideal as a change I'd like to have. |
@jp9000 I ended up switching to QSlider subclass since it allows for more customization. Now the Sliders are disabled in properties, but if you were to click on the Slider, the wheel works again. I set a focus policy to do this like the snippet @SuslikV posted above. I will continue to do the same for combobox and spinbox after I get some feedback on the subclassing. I kept a copy of the event filter way as well just to look at both ways. Sorry I didn't see your comment earlier about keeping it the way it is. This is the kind of trait I would guess @dodgepong was talking about for volume. Using the wheel scroll is still useful, but I think it makes sense that this is only active when the Slider is focused. I would think that should be a different issue since it is working in a different section. This issue would only cover properties for now. |
Okay, I think that sounds good. I'll do some more testing. I think I misunderstood the situation a bit. |
I agree subclassing with a focus policy that enables the scroll wheel is a good idea. |
I prefer the subclass method from the UX standpoint. Disabling the scroll wheel entirely is not ideal, as many users (myself included) use the scroll wheel to change property values. The issue is more that it's too easy to accidentally change it when scrolling the properties window itself. Scroll when focused is the correct solution, IMO. |
Just a note. Event filter allows same behavior, simply it was implemented not the best way in the first place. And I promote sub-classing for different reason. As soon as platforms were mentioned I should to clarify my thoughts. |
Testing it on Win10 64, When I click to focus on the slider, I can adjust the slider using wheel scroll as long as my mouse stays above the slider. Once the mouse moves away, the slider is no longer in focus and the scroll goes back to scrolling the full page. I have to go back and click the slider to gain focus again. |
I am going to start implementing the same solution to Spinbox and Combobox today. |
virtual vs override? |
I made subclasses of combobox and spinbox and implemented them to the properties. |
I think, obs uses next semantics (almost everywhere in its code):
(both |
@jp9000 what do think of this implementation. I would like to have this PR merged and closed. Thank you all for your feedback! |
You will be asked to remove unneeded parentheses when
to
|
I refactored the if else statements. |
I'm not merging anything to obs. As for commits follow the https://github.com/obsproject/obs-studio/blob/master/CONTRIBUTING.rst#commit-guidelines Then wait. From few days to few years... |
I am a bit confused on what you mean |
0796669
to
f2c550e
Compare
629d2e6
to
5b37a62
Compare
Ran into some issues with git to remove the authors commit. I think its fine now. All changes are squashed into one commit and the Authors changes are removed. |
You know, contributing guidelines were updated... (capital letter in the commit's title after the module name is now mentioned, de-facto it was long time like this) |
Ignore wheelEvent using subclass slider,spinbox,combobox with eventhandlers: wheelEvent - ignore if widget is not focused, leaveEvent - clear focus when mouse leaves event. Use these new subclass widgets in properties to ignore wheelEvent when scrolling.
5b37a62
to
9249403
Compare
0001214: Scroll wheel events modifies keyboard focus
Uses eventFilter to disable scrollwheel for comboBox, Slider, and Spin box when adding sources.