QMacStyle: Return a guess for SE_ProgressBarGroove's rect

QMacStyle doesn't know how to accurately compute SE_ProgressBarGroove
But, since we only need the progress bar's main dimension, its rect
is good enough for QProgressBarPrivate::repaintRequired().

Change-Id: I81e936003b847cc9cc0ddf4fbfc05ddc1c9f6625
Task-number: QTBUG-51120
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
This commit is contained in:
Gabriel de Dietrich 2016-03-21 14:16:09 -07:00
parent 88fae806a8
commit 72ff2a2f0d
2 changed files with 4 additions and 1 deletions

View File

@ -4978,6 +4978,9 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
break;
}
case SE_ProgressBarGroove:
// Wrong in the secondary dimension, but accurate enough in the main dimension.
rect = opt->rect;
break;
case SE_ProgressBarLabel:
break;
case SE_ProgressBarContents:

View File

@ -155,7 +155,7 @@ bool QProgressBarPrivate::repaintRequired() const
QStyleOptionProgressBar opt;
q->initStyleOption(&opt);
int cw = q->style()->pixelMetric(QStyle::PM_ProgressBarChunkWidth, &opt, q);
QRect groove = q->style()->subElementRect(QStyle::SE_ProgressBarGroove, &opt, q);
QRect groove = q->style()->subElementRect(QStyle::SE_ProgressBarGroove, &opt, q);
// This expression is basically
// (valueDifference / (maximum - minimum) > cw / groove.width())
// transformed to avoid integer division.