[Development] API review: Updating QWheelEvent

Denis Dzyubenko denis at ddenis.info
Tue Jan 17 18:20:53 CET 2012


Hi Morten,

On Tue, Jan 17, 2012 at 2:42 PM,  <morten.sorvig at nokia.com> wrote:
> QWheelEvent has fallen a bit behind and needs an update. It was once used for mouse wheel events only, but is today also used for scroll events generated from trackpad swipe gestures.
>
> There are two main issues:
>
> * QWheelEvents are either horizontal or vertical, requiring two events and two calls to update() for a diagonal scroll.
> * The delta unit is wheel degrees, high-res trackpads send pixel-based deltas.


yay, that's a great initiative! Hopefully this will ensure there no
laggy scrolling in Qt on Mac! +2 from me.

>
> To fix this I'd like to deprecate QWheelEvent::delta() and QWheelEvent::orientation() and add:
>
> QPoint pixelDelta() const
> QPoint angleDelta() const
>
> pixelDelta() returns the delta in pixels, if the platform supports it. angleDelta() returns the same values as delta(), but with both dx and dy values in the same event. In order to preserve behavior compatibility with Qt 4 we also need to send "compat" events with the second orientation() and delta(). These will have pixelDelta and angleDelta set to null.

I am not big fan of "pixelDelta" and "angleDelta" as function names,
but I don't have any better suggestions.

Denis.



More information about the Development mailing list