[Qt-interest] Model/View and animation

Paul Miller paul at fxtech.com
Tue Mar 17 17:56:04 CET 2009


Dmitry Nezhevenko wrote:
> Hi. I'm learning how to add some kind of animation to TreeView based on
> Qt Model/View architecture.
> 
> I've some kind of two-column tree that contains text (Qt::DisplayRole) and
> icon (Qt::DecorationRole). Now for some external event I want to
> "highlight" some item by using blinking every second icon. What is the
> best way to implement such blinking? 

Is your model really changing every second, or are you just trying call 
attention to it in the view for some reason?

If your model isn't really changing, I'd avoid the model-based approach. 
If you just have certain items you want to blink for some reason and the 
underlying data isn't changing, the "right" thing would be sticking a 
timer on your view and have your delegate do the updates.

Sadly, there is a lot of display oriented stuff in the model already so 
it may be your best choice. I know the delegate is supposed to be like 
the "controller" side of things but you have to do too much work in the 
delegate just to override a few things.

Maybe you could describe in more detail why your item(s) are blinking?



More information about the Qt-interest-old mailing list