Merge pull request #14583 from glassez/progress

Correctly draw progress bar in Qt 6
This commit is contained in:
Vladimir Golovnev 2021-03-24 07:23:53 +03:00 committed by GitHub
commit 7bc5bfa140
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,7 +58,8 @@ void ProgressBarPainter::paint(QPainter *painter, const QStyleOptionViewItem &op
styleOption.textVisible = true;
// QStyleOption fields
styleOption.rect = option.rect;
styleOption.state = option.state;
// Qt 6 requires QStyle::State_Horizontal to be set for correctly drawing horizontal progress bar
styleOption.state = option.state | QStyle::State_Horizontal;
const bool isEnabled = option.state.testFlag(QStyle::State_Enabled);
styleOption.palette.setCurrentColorGroup(isEnabled ? QPalette::Active : QPalette::Disabled);