diff options
author | Tang Haixiang <tanghaixiang@uniontech.com> | 2021-08-11 13:52:11 +0800 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-08-23 08:27:04 +0000 |
commit | 43f96f7fba575351c90534ad8d66e9485ca382aa (patch) | |
tree | a2c9460646c363629ccafda6b1eed140c6903c89 /src/widgets | |
parent | 548640a058420c6471c5cf24ff21ef93a4492b30 (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>
Change-Id: I0d081a4ad7aee4a563acb988c0ef19a646bf1eea
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 77bdce84965662a67162d1272245b168c96875db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/widgets')
-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 5772c7d4c4..0a09526701 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1099,10 +1099,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; |