Reputation: 11537
I'm using the Nokia Qt SDK and designed a small banner carousel in the top area. It looks like this:
The hierarchy looks like:
After installing this in the emulator, I try to make it scrollable (flinging). It's a simple task I would guess (like ScrollView
in Android, or UIScrollView
in iOS), but so far no joy. All links in the internet point me of custom scroll implementations etc etc. which I don't want to do nor expect to do as Qt should be a higher level framework? What is the state of the art here? ;-)
Question in short: How can I make this QScrollArea
respond to touch (fling, scroll, drag etc) events and reveal the other widgets in the queue? I'm not expecting it to be able to "snap" into a child widget (which is another requirement later ;)).
Upvotes: 4
Views: 7933
Reputation: 3248
Take a look at Flickable (at http://blog.qt.io/blog/2009/07/19/kinetic-scrolling-on-any-widgets/) and FlickCharm (linked to from that first address ) either to have an idea on how to implement it on your own or use it as is.
Note that it might not be necessary if your target is Maemo, as its Qt port handles it.
Upvotes: 3
Reputation: 7125
Have you tried enabling gestures? I haven't used the gesture support yet, but it looks like it's as easy as
scrollEvents->grabGesture(Qt::SwipeGesture);
// or...
scrollEvents->grabGesture(Qt::PanGesture);
I don't know if QScrollArea already handles gestures, so if that doesn't work, you may need to sub-class QScrollArea and override the event
method to handle gesture events, as described in the Gestures Programming Guide.
Upvotes: 0