I've been playing a开发者_JS百科round with the Flickable class from Qt Labs. I understand pretty well how the example works, but I'm having trouble understanding how I can use it to display something other than something dynamically painted inside the paintEvent.
If I have a list of buttons that I want to be Flickable, is there a way to reimplement the Flickable paintEvent to call all the button's paintEvents?
It seems like the Flickable class pretty much figures out which buttons would be visible so all I'd have to do for each button is set its y position and tell it to paint itself at that position.
Any pointers would be appreciated...
In your subclass, you need to reimplement setScrollOffset. There you can do various things. The included ColorList just triggers a repainting update, but theoretically you could also e.g. move widgets around. In fact, there is no need to reimplement paintEvent in any subclass of Flickable.
Note: I wrote that Flickable class.
精彩评论