From 77bdce84965662a67162d1272245b168c96875db Mon Sep 17 00:00:00 2001 From: Tang Haixiang Date: Wed, 11 Aug 2021 13:52:11 +0800 Subject: Modify the internal rectangle drawing of CE_RubberBand adjusted(1, 1, -2, -2) makes the rectangle smaller, but when rect.x1-rect.x2 = 0. Then x1 + 1, x2-2 leads to x1> x2. This will make the rectangle flip in advance. So there is a difference between the updated area and the drawn area. Add a judgment, when the rectangle we get is large enough, draw the inner rectangle. Fixes: QTBUG-95716 Done-with: Oliver Eftevaag Done-with: Volker Hilsheimer Pick-to: 6.2 Change-Id: I0d081a4ad7aee4a563acb988c0ef19a646bf1eea Reviewed-by: Oliver Eftevaag Reviewed-by: Volker Hilsheimer --- src/widgets/styles/qfusionstyle.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/widgets/styles') diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index c7158adf7b..638915b342 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1088,10 +1088,13 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio painter->translate(0.5, 0.5); painter->setBrush(dimHighlight); painter->drawRoundedRect(option->rect.adjusted(0, 0, -1, -1), 1, 1); - QColor innerLine = Qt::white; - innerLine.setAlpha(40); - painter->setPen(innerLine); - painter->drawRoundedRect(option->rect.adjusted(1, 1, -2, -2), 1, 1); + //when the rectangle we get is large enough, draw the inner rectangle. + if (option->rect.width() > 2 && option->rect.height() > 2) { + QColor innerLine = Qt::white; + innerLine.setAlpha(40); + painter->setPen(innerLine); + painter->drawRoundedRect(option->rect.adjusted(1, 1, -2, -2), 1, 1); + } painter->restore(); } break; -- cgit v1.2.3