[Development] mouse wheel zooming and inertial scrolling
Morten.Sorvig at theqtcompany.com
Wed Sep 2 10:55:34 CEST 2015
> On 01 Sep 2015, at 18:50, René J.V. Bertin <rjvbertin at gmail.com> wrote:
> Qt4 and Qt5 both have a "feature" where holding down the Meta key (Command on OS X) while scrolling a view causes text in the view to zoom in or out. This also works with the 2-finger scroll that most trackpads provide nowadays.
> Under Qt4 it doesn't work very nicely with inertial scrolling however, at least not when the inertia is simulated by the input handler. If you give the view a good push and then use the Meta key to use a keyboard shortcut before the scrolling stopped, the text is zoomed. That's very annoying, and someone rightly managed to fix this in Qt5. There, scrolling continues even after pressing the Meta key, and from what I see it also continues if you activate a shortcut.
> Where is this achieved, and would it be possible to backport it to Qt4 (a local patch would be fine with me)?
On the OS X side his is handled in the platform plugin: We read the key modifier state at the beginning of the scroll event sequence.
The code in question is in - (void)scrollWheel:(NSEvent *)theEvent in qnsview.mm
More information about the Development