Hi,

I'm displaying QProgressBars in a QTreeView by subclassing QItemDelegate. Here's the code:
Qt Code:
  1. void ProgressBarItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
  2. {
  3. QStyleOptionProgressBar progressBarOption;
  4. progressBarOption.state = QStyle::State_Enabled;
  5. progressBarOption.direction = QApplication::layoutDirection();
  6. progressBarOption.rect = option.rect;
  7. progressBarOption.fontMetrics = QApplication::fontMetrics();
  8. progressBarOption.textAlignment = Qt::AlignCenter;
  9. progressBarOption.textVisible = true;
  10.  
  11. if(...)
  12. {...}
  13. else if(...)
  14. {...}
  15. else if(...)
  16. {
  17. progressBarOption.progress = 50;
  18. progressBarOption.minimum = 0;
  19. progressBarOption.maximum = 100;
  20. }
  21.  
  22. QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter);
  23. }
To copy to clipboard, switch view to plain text mode 

As you can see I'm using the marquee animation of the progress bar (in some conditions) by setting minimum and maximimum to 0.
I actually get the animation, but it doesn't look well because the progress bar isn't redrawn fast enough.
Is there a way to redraw the progress bar fast enough to display the animation properly? Is it possible to tell the QItemDelegate to call paint() more frequent? Is it possible to display an QProgressBar directly, instead of calling QApplication::style()->drawControl(...)?