[Qt-interest] QProgressBar in a QStyledItemDelegate

Andre Somers andre at familiesomers.nl
Wed Aug 5 09:30:59 CEST 2009


Matt Broadstone wrote:
> Hi,
>   I've read a number of great articles on drawing a QProgressBar by
> hand in an item view (not to mention the example in the torrent
> example), however I had a slightly more advanced example in which this
> was not possible. I have a QListView of items in a collection of
> tasks, and as each task is run (only one at a time) I want a progress
> bar displayed for the task. The kicker here is that I also want
> support for indeterminate progress bars (the "barber's pole" look when
> min/max range is set to 0). As far as I was able to determine (and
> from discussions with kdepepo on #qt on freenode) this is simply not
> possible without an actual widget, as the style needs to register the
> widget and call update on it according to an animation timer. What to
> do.. well instead I created a QProgressBar widget in my delegate and
> in the paint method just move it to the correct coords based on
> whether the index is the "active" task. This worked fine, though
> perhaps a bit inefficiently, on Mac but as soon as I ran the code on
> Windows I had all sorts of crashes. Can anyone think of a better
> solution to this problem? Obviously drawing it myself would be ideal,
> but I just can't see how that's possible.
>
> Thanks!
>   Matt Broadstone
> _______________________________________________
>   
I have not looked at it myself, but perhaps a small creative-friday 
project from the Trolls can help you?
Google on ItemsViewNG.

André



More information about the Qt-interest-old mailing list