Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
6.7.1
-
None
-
Fedora 39
QT 6.7.1 installed via the QT Maintenance tool.
QT 5 system version
-
-
369b5a319 (dev), 3a32bab2a (6.8), 569b4bbc8 (6.7)
Description
I use QStyleOptionProgressBar in my Application to have a percent indicator in a Tree view. The code stopped working with QT 6.* . In QT 5.* the same code still works. Is this a bug or has something changed in the way delegate painting is handled?
The code is:
```
void InstrumentDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{{{}}
painter->save(); // Setup basic layout
QStyleOptionProgressBar progressBarOption = {};
progressBarOption.state = QStyle::State_Enabled;
progressBarOption.bottomToTop = false;
progressBarOption.direction = QApplication::layoutDirection();
progressBarOption.rect = option.rect.adjusted(0, 0, 0, 0);
progressBarOption.minimum = 0;
progressBarOption.maximum = 100;
progressBarOption.textAlignment = Qt::AlignCenter;
progressBarOption.textVisible = true; // Set the progress and text values of the style option.
double percent = 50.0;
progressBarOption.progress = (int)(percent);
progressBarOption.text = QString::asprintf("%.2f%%", percent); //painter->fillRect(progressBarOption.rect, QColor::fromRgb(255,0,0));
QApplication::style()>drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter); painter>restore();
}
```
The result with QT6 (Style fusion):
The result with QT6 (Style windows): (Text missing, bar not at 50%)
The result with QT5:
I created a small reproducer:
My environment:
Fedora 39
QT 6.7.1 installed via the QT Maintenance tool.
QT 5 system version