[REOPEN] [SOLVED] How to disable input value change with scroll wheel?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
ceremcem
Posts: 226
Joined: Sun Jan 07, 2018 11:10 am

[REOPEN] [SOLVED] How to disable input value change with scroll wheel?

Post by ceremcem »

IMHO, it's a dangerous decision for an engineering application to let the user change a numerical input value with mouse scroll wheel, because a value might be accidentally changed while scrolling in the property window.

How can we disable the "scroll to change" behaviour for all inputs?
Last edited by ceremcem on Tue Sep 11, 2018 7:27 am, edited 1 time in total.
chrisb
Veteran
Posts: 53933
Joined: Tue Mar 17, 2015 9:14 am

Re: How to disable input value change with scroll wheel?

Post by chrisb »

ceremcem wrote: Fri Sep 07, 2018 3:10 pma value might be accidentally changed while scrolling in the property window.
This has hapened to me several time, while I hardly use the scroll function. However, I'm afraid that this is some Qt standard inheritance.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: How to disable input value change with scroll wheel?

Post by TheMarkster »

This was discussed by core developers in 2011: https://www.freecadweb.org/tracker/view.php?id=377
User avatar
ceremcem
Posts: 226
Joined: Sun Jan 07, 2018 11:10 am

Re: How to disable input value change with scroll wheel?

Post by ceremcem »

TheMarkster wrote: Fri Sep 07, 2018 6:10 pm This was discussed by core developers in 2011: https://www.freecadweb.org/tracker/view.php?id=377
I believe Qt would provide some mechanism to override this behavior (like this), so I guess this is totally a task of FreeCAD.
chrisb wrote: Fri Sep 07, 2018 5:34 pm This has hapened to me several time, while I hardly use the scroll function.
I think this may lead even more serious issues since we are not able to use "git diff" like verification mechanism to detect any accidental data changes.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: How to disable input value change with scroll wheel?

Post by TheMarkster »

ceremcem wrote: Fri Sep 07, 2018 7:02 pm
I believe Qt would provide some mechanism to override this behavior (like this), so I guess this is totally a task of FreeCAD.
I think there are ways provided by Qt. I searched for it after reading your post, and found something related to event filters and subclassing. I'm not sure about it being totally a task of FreeCAD. Generally, applications should not go about modifying the way system-wide components behave, absent some need unique to that application for doing so.

By the way, I also find the behavior to be both a blessing and a curse at different times. It's a very convenient way to change the value of a property, especially if the value you want falls on a whole number integer value, but it's annoying when it happens by accident. I think a better implementation would be to require shift+scroll (or similar) to change the contents.
User avatar
ceremcem
Posts: 226
Joined: Sun Jan 07, 2018 11:10 am

Re: How to disable input value change with scroll wheel?

Post by ceremcem »

TheMarkster wrote: Fri Sep 07, 2018 8:38 pm I think a better implementation would be to require shift+scroll (or similar) to change the contents.
I was thinking exactly the same: I would define this behavior as "a controlled version of scroll to change the value", thus I thought Ctrl+scroll. But anything other than a simple scroll would suffice.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: How to disable input value change with scroll wheel?

Post by sgrogan »

ceremcem wrote: Fri Sep 07, 2018 7:02 pm I believe Qt would provide some mechanism to override this behavior (like this), so I guess this is totally a task of FreeCAD.
Not sure, but I think this is C++ http://doc.qt.io/archives/qt-4.8/qspinbox.html I don't think we use Qtquick.

Never said this before, but this should probably be moved or transition the discussion to the Developers sub-Forum.
"fight the good fight"
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: How to disable input value change with scroll wheel?

Post by wandererfan »

TheMarkster wrote: Fri Sep 07, 2018 8:38 pm By the way, I also find the behavior to be both a blessing and a curse at different times. It's a very convenient way to change the value of a property, especially if the value you want falls on a whole number integer value, but it's annoying when it happens by accident. I think a better implementation would be to require shift+scroll (or similar) to change the contents.
I'm in the curse camp, I'm afraid. I change values with the scroll wheel by accident far more often than on purpose.

<technobabble>
Gui::QuantitySpinBox and Gui::UIntSpinBox have FocusPolicy = Qt::WheelFocus by default. The problem can be partly solved by setting the FocusPolicy to Qt::StrongFocus instead. Here is a discussion from stackoverflow about handling this situation.
The code changes would be in /Gui/propertyeditor/PropertyItem.cpp, but I don't know the ramifications of setting StrongFocus everywhere.
</technobabble>

@wmayer or somebody else familiar with the property editor would have to pass judgement on this one.
User avatar
ceremcem
Posts: 226
Joined: Sun Jan 07, 2018 11:10 am

Re: [SOLVED] How to disable input value change with scroll wheel?

Post by ceremcem »

@realthunder has solved the issue. Currently it seems it's safer to navigate in the property window.
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: [SOLVED] How to disable input value change with scroll wheel?

Post by realthunder »

Just create a PR for this.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
Post Reply