From 5c2b81d78fb6ad9fcdd9612efb5aac714632ae49 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 2 Mar 2021 11:50:16 +0800 Subject: [PATCH] Correctly draw the background of progress bar Closes #12271. --- src/gui/progressbardelegate.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/progressbardelegate.cpp b/src/gui/progressbardelegate.cpp index 706f80799..0666142c2 100644 --- a/src/gui/progressbardelegate.cpp +++ b/src/gui/progressbardelegate.cpp @@ -53,7 +53,6 @@ void ProgressBarDelegate::initProgressStyleOption(QStyleOptionProgressBar &optio option.progress = static_cast(index.data(m_dataRole).toReal()); option.maximum = 100; option.minimum = 0; - option.state |= (QStyle::State_Enabled | QStyle::State_Horizontal); option.textVisible = true; } @@ -65,9 +64,11 @@ void ProgressBarDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o QStyleOptionProgressBar newopt; newopt.initFrom(&m_dummyProgressBar); newopt.rect = option.rect; + newopt.state = option.state; initProgressStyleOption(newopt, index); painter->save(); + m_dummyProgressBar.style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter); m_dummyProgressBar.style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter, &m_dummyProgressBar); painter->restore(); }