[Interest] [External] Re: Change modifier for horizontal scrolling with mousewheel

Sean Murphy Sean.M.Murphy at us.kbr.com
Fri May 20 20:53:55 CEST 2022


> If you want to also disable the Alt modifier's effect, then things get a bit
> trickier (if Alt is held, assume that the original event is flipped, so unflip it).

I think I probably do want to disable Alt, but I'm not 100% convinced of that yet.
I might be able to get away with just adding Shift+wheel to behave the same as
Alt+Wheel. At least until someone says that they want Alt+Wheel to do something
completely different!

> If you want this to be the UX for all your QAbstractScrollArea widgets, then
> you can install an event filter on the viewport of all of them. You could also
> try to override QApplication::notify, and call the parent class implementation
> with your flipped QWheelEvent. In that case, only apply your logic if the
> original event has the QEvent::spontaneous bit set. However, that will then
> also impact widgets such as a tab bar or a spinbox unless you use
> qobject_cast to verify that the receiver's parent is a QAbstractScrollArea.

Thankfully I only care about doing this for an existing custom class that inherits
QGraphicsView, so I don't need to worry about an across-the-board change

Thanks for the detail explanation of what happens under the hood, as well as
what steps to take to solve this.

Any chance the ability to control the modifiers could be a built-in Qt ability
down the road? From the one user of mine that requested it, he believes that
the shift+wheel for horizontal scrolling is "standard behavior on all Windows
apps", which I've verified is not true - there doesn't seem to be a universal
way to do horizontal scrolling with the mouse wheel. Nevertheless, it would be
nice to be able to easily set that behavior to make Qt-based apps feel more
natural to users.

Sean
This e-mail, including any attached files, may contain confidential information, privileged information and/or trade secrets for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.


More information about the Interest mailing list