QStyleSheetsStyle: Avoid possible division by zero

Change-Id: I5a7588c07106227e2a8b5e1f180230ef5b0342d1
Task-number: QTBUG-65228
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Gabriel de Dietrich 2018-01-15 18:03:36 -08:00
parent 631f68c972
commit 0236e3ab94

View File

@ -3971,10 +3971,11 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
x += reverse ? -chunkWidth : chunkWidth;
--chunkCount;
};
} else {
} else if (chunkWidth > 0) {
const int chunkCount = ceil(qreal(fillWidth)/chunkWidth);
int x = reverse ? r.left() + r.width() - chunkWidth : r.x();
for (int i = 0; i < ceil(qreal(fillWidth)/chunkWidth); ++i) {
for (int i = 0; i < chunkCount; ++i) {
r.setRect(x, rect.y(), chunkWidth, rect.height());
r = m.mapRect(QRectF(r)).toRect();
subRule.drawRule(p, r);