QsKineticScroller
-
Is it possible to add kinetic scrolling to a project like the one provided by Nokia Qt SDK => "Creating a mobile application with Nokia Qt SDK"?
The applications base class is QDialog.
Following the QsKineticScroller article http://blog.codeimproved.net/2010/12/kinetic-scrolling-with-qt-the-what-and-the-how/ I've tried within the constructor:@QsKineticScroller *scroller = new QsKineticScroller(this);
QAbstractScrollArea *area = new QAbstractScrollArea(this);
area->setViewport(parent);
scroller->enableKineticScrollFor(area);
@But nothing happened. What's wrong here?
Thanks. -
Line 3 looks very suspicious. Setting the parent as the contents of a child? That doesn't sound right...
-
OK - so how to set the QAbstractScrollArea to the parent widget?
Thank you! -
Errr... perhaps you should explain to us what you want to achieve. You are not making much sense. A parent widget can not be "set to" (?) a widget that is a child of that same parent. Makes at little sense as claiming that your grandmother is your child.
-
I would like to get a scrollable dialog that contains multiple line edits, progress bars and other display widgets.
I wonder if it's possible to define a QAbstractScrollArea that covers the whole dialog (designed by the designer of Qt Creator). If yes this area should be given to enableKineticScrollFor().
Is this approach possible?
If not - what would be the right way?
Thank you! -
Yes. It is.
Simply do exactly as you describe above: create a Qt form class in designer, put a big scroll area on it (not QAbstractScrollArea, "abstract" classes are not meant for direct use but for subclassing), and put the widgets you want on that. Give the scroll area a name like "scrollArea" Should work like a charm.Now, in code, add a few lines to the constructor of your class (the one where'll find the setupUi call), and simply add:
@
QsKineticScroller *scroller = new QsKineticScroller(this);
scroller->enableKineticScrollFor(ui->scrollArea);
@ -
Great - it works fine.
Hoever - I had to disable "widgetResizable" for the scrollArea to get scrolling.
Is this ok?Thank you for your help!
-
I try to put webView widget on the scrollArea but seems like it doesn't work.. should it be working on webView or not?
Thanks in advance,
-=J=-