[Qt-interest] Model/View and animation

Dmitry Nezhevenko dion at inhex.net
Tue Mar 17 18:11:43 CET 2009


On Tue, Mar 17, 2009 at 12:56:04PM -0400, Paul Miller wrote:
> 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?

No. Currently model just changes once to indicate that something happens.

> 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.

So third solution is to do timer-based stuff in deletgate. Any way to
"invalidate" state of just single QModelIndex so it will be repainted?

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

Blinking icon is _just_ notification that user should look to it. Nothing
more.

-- 
WBR, Dmitry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090317/2f39f99b/attachment.bin 


More information about the Qt-interest-old mailing list