mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 21:03:30 -07:00
render a transparent bar for progress less than 1
This commit is contained in:
parent
b7a43ea118
commit
57b12660b4
1 changed files with 9 additions and 1 deletions
|
@ -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();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue