render a transparent bar for progress less than 1

This commit is contained in:
Mark 2025-07-06 20:15:30 +04:00
commit 57b12660b4

View file

@ -72,8 +72,16 @@ void ProgressBarPainter::paint(QPainter *painter, const QStyleOptionViewItem &op
const bool isEnabled = option.state.testFlag(QStyle::State_Enabled); const bool isEnabled = option.state.testFlag(QStyle::State_Enabled);
styleOption.palette.setCurrentColorGroup(isEnabled ? QPalette::Active : QPalette::Disabled); styleOption.palette.setCurrentColorGroup(isEnabled ? QPalette::Active : QPalette::Disabled);
if (m_chunkColor.isValid()) if (progress < 1)
{
// display a white transparent bar for progress < 1
// workaround for QT rendering a 1-pixel wide progress bar even though the progress is still at 0 to 1 %
styleOption.palette.setColor(QPalette::Highlight, QColor(255, 255, 255, 0));
}
else if (m_chunkColor.isValid())
{
styleOption.palette.setColor(QPalette::Highlight, m_chunkColor); styleOption.palette.setColor(QPalette::Highlight, m_chunkColor);
}
painter->save(); painter->save();
const QStyle *style = m_dummyProgressBar.style(); const QStyle *style = m_dummyProgressBar.style();