mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-24 13:34:27 +00:00
Merge pull request #14472 from Chocobo1/progressbar_draw
Correctly draw the background of progress bar
This commit is contained in:
commit
752b45083c
@ -53,7 +53,6 @@ void ProgressBarDelegate::initProgressStyleOption(QStyleOptionProgressBar &optio
|
|||||||
option.progress = static_cast<int>(index.data(m_dataRole).toReal());
|
option.progress = static_cast<int>(index.data(m_dataRole).toReal());
|
||||||
option.maximum = 100;
|
option.maximum = 100;
|
||||||
option.minimum = 0;
|
option.minimum = 0;
|
||||||
option.state |= (QStyle::State_Enabled | QStyle::State_Horizontal);
|
|
||||||
option.textVisible = true;
|
option.textVisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,9 +64,11 @@ void ProgressBarDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
|
|||||||
QStyleOptionProgressBar newopt;
|
QStyleOptionProgressBar newopt;
|
||||||
newopt.initFrom(&m_dummyProgressBar);
|
newopt.initFrom(&m_dummyProgressBar);
|
||||||
newopt.rect = option.rect;
|
newopt.rect = option.rect;
|
||||||
|
newopt.state = option.state;
|
||||||
initProgressStyleOption(newopt, index);
|
initProgressStyleOption(newopt, index);
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
|
m_dummyProgressBar.style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter);
|
||||||
m_dummyProgressBar.style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter, &m_dummyProgressBar);
|
m_dummyProgressBar.style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter, &m_dummyProgressBar);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user