diff options
author | Tang Haixiang <tanghaixiang@uniontech.com> | 2021-08-11 13:52:11 +0800 |
---|---|---|
committer | Tang Haixiang <tanghaixiang@uniontech.com> | 2021-08-23 16:26:55 +0800 |
commit | 77bdce84965662a67162d1272245b168c96875db (patch) | |
tree | ffd42ff6e03c9fc777dd6c509a97625d0b192791 /src/widgets/styles/qfusionstyle.cpp | |
parent | d8f815db7f5eb2bdfb911dbf6d28da17c0a47025 (diff) |
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 <oliver.eftevaag@qt.io>
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Pick-to: 6.2
Change-Id: I0d081a4ad7aee4a563acb988c0ef19a646bf1eea
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/styles/qfusionstyle.cpp')
-rw-r--r-- | src/widgets/styles/qfusionstyle.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
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; |