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:
parent
88fae806a8
commit
72ff2a2f0d
@ -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:
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user