Sam
Sam

Reputation: 61

Two finger moving smooth and kinetic scrolling with trackpad or touchpad?

I am working on a Qt application which resembles hex editor for Mac. (picture from Google) enter image description here

It has a very large portion of data to scroll vertically(upward and downward) because it shows all large files data in hex format.

In my application, I'd like to add two finger smooth scrolling in both direction: up and down like that in Macbook Air two finger scrolling. It work properly with mouse wheel but not with trackpad two finger move scrolling.

If someone has a solution, please help me out. Thanks in advance.

Upvotes: 0

Views: 2150

Answers (1)

phyatt
phyatt

Reputation: 19122

The scroller allows for gestures like click and drag to do kinetic scrolling.

http://qt-project.org/doc/qt-5/qscroller.html#details

Note on this page:

QScroller::TouchGesture 0 
The gesture recognizer will only trigger on touch events. Specifically it will react on single touch points when using a touch screen and dual touch points when using a touchpad.

So then the example they give would turn into this for you:

QWidget *w = ...;
QScroller::grabGesture(w, QScroller::TouchGesture);

There is more on doing new things with touch screens and touch pads by handling the QTouchEvent:

http://qt-project.org/doc/qt-5/qtouchevent.html#details

Hope that helps.

Upvotes: 1

Related Questions