PDA

View Full Version : Kinetic scrolling in QTextArea/Browser



alexandernst
13th January 2011, 19:26
I'm looking for a library/example implementing kinetic scrolling in a QTextArea/Browser.
I had a look at Flickable/FlickCharm, but they don't really do what I want.
Those libs enable the kinetic scrolling effect after you hold left-mouse-button and drag fast, and that's why you can't select text while that's enabled.
I'd like to be able to select text, so, no kinetic scrolling while dragging, but instead of that it should be activated on mouse scroll button.

Any ideas? Thanks

alexandernst
14th January 2011, 11:34
Nobody?
I know that KDE team had to implement something similar to Dolphin, but I can't find anything related in git.

wysota
14th January 2011, 12:00
Take the flick charm code and modify it to react on mouse wheel instead of mouse release.

alexandernst
14th January 2011, 14:04
Well, that isn't really helpful :/
I already knew that I need to ake it work with the QWheelEvent, but I don't know how. I need some example.

wysota
14th January 2011, 14:33
What is it exactly that you don't know? You need to modify the event filter implementation and react on mouse wheel events to trigger auto-scrolls. Or you can just make scrolling triggered by the middle mouse button instead of left mouse button to trigger scrolling and retain the selection functionality.

wysota
14th January 2011, 18:47
By the way, have a look at QAbstractKineticScroller (http://doc.qt.nokia.com/qt-maemo-4.7/qabstractkineticscroller.html). It might be easier if you just implement this interface. You might need to borrow some code from the maemo port, I don't know if this class is part of mainstream Qt.