[Qt-interest] Mac: Two finger swipe and mouse wheel event
Lalitha Sankh
slalitha at info-telecomsys.com
Fri Feb 12 12:01:50 CET 2010
Can one tell how to compile qt sources..
And which folder I should use
Thanks & Regards,
Lalitha.S
ITS India
Innovation is Unlimited Imagination
slalitha at info-telecomsys.com
-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Richard Moe
Gustavsen
Sent: Friday, February 12, 2010 4:05 PM
To: QT Mailing LIST
Subject: Re: [Qt-interest] Mac: Two finger swipe and mouse wheel event
> When using the mouse wheel, I get values which are typically multiples
> of 8*15=120, while for the two finger swipe I now get multiples of 1.
> How can I handle this transparently? Would like to avoid a line such
> as
> this:
> if (abs(delta) < 120) delta *= 120
The API has not changed, but developers tend to assume that delta is
always 120, which is true in many cases. But it can be both higher and
lower. On Mac, Mighty Mouse, Magic Mouse and the trackpad has much
higher granularity on the mouse wheel than standard mices. So to
support smooth pixel-based scrolling like other native apps on Mac, we
send out wheel events more often, with a corresponding lower delta.
So if you want the standard line-based scrolling, just accumulate
delta until is reaches 120, then scroll one line (or do one swipe in
your case, I guess). E.g.:
_delta += event->delta();
int linesToScroll = int(_delta/120);
_delta -= linesToScroll * 120;
if (linesToScroll > 0) { ... }
> Is this maybe related to the new QGesture infrastructure?
No.
-Richard
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list