View Full Version : Scrollbar code

26th October 2010, 20:31
Has anyone coded a scrollbar in QML like the ones used in desktop apps?
I looked at the scrollbar example but that only reacts to the flickable image. I would like something similar but instead of flicking the image you could use the scrollbar to move the image, you know, like a scrollbar...

26th October 2010, 20:52
You can use the ScrollBar element from the example. It's just the way you use it that needs to be changed. The position of the image needs to be bound to the value of the scroll bar, not the other way round. You'll just need to add a mouse area to the scroll bar to handle position changes.

26th October 2010, 21:30
Thanks. I knew that but was unsure how exactly to make it happen. I just started using QML yesterday. Any source code would be appreciated.:)

26th October 2010, 21:38
Well then you are one day ahead of me ;) I only managed to write a simple "hello world" app a couple of weeks ago. Take a look at the MouseArea example.

23rd April 2011, 15:55
Might be a bit late but I have implemented a dynamic ScrollArea with native desktop scrollbars here: https://qt.gitorious.org/qt-components