diff options
author | Rolf Eike Beer <eb@emlix.com> | 2018-08-27 13:08:53 +0200 |
---|---|---|
committer | Rolf Eike Beer <eb@emlix.com> | 2018-09-03 10:51:14 +0000 |
commit | a3ee0b94daa5840590dc8b9b546d997d0823b55f (patch) | |
tree | c50f71d0993feb5e0ad7f6ad9720c91eb413a035 | |
parent | 69a2bc7a2a9ab7192024f93df3af9d07b15ebcf1 (diff) |
QWindowsStyle: respect rectangle when drawing PE_IndicatorViewItemCheck
This is a follow-up on commit 6553921dd537e416da2f4d1441ab6d63059cda60,
which fixed the drawing of the surrounding rectangle when used in item
views. This one now fixes the drawing of the check mark itself, for both
item views and standalone items.
Change-Id: I14f359e9d2ef33652cc68494b7d114e61110e5e0
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | src/widgets/styles/qwindowsstyle.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index d4ccd0931e..611de6991f 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -845,12 +845,14 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, #endif // QT_CONFIG(itemviews) if (!(opt->state & State_Off)) { QPointF points[6]; - points[0] = { opt->rect.x() + QStyleHelper::dpiScaled(3.5), opt->rect.y() + QStyleHelper::dpiScaled(5.5) }; - points[1] = { points[0].x(), points[0].y() + QStyleHelper::dpiScaled(2) }; - points[2] = { points[1].x() + QStyleHelper::dpiScaled(2), points[1].y() + QStyleHelper::dpiScaled(2) }; - points[3] = { points[2].x() + QStyleHelper::dpiScaled(4), points[2].y() - QStyleHelper::dpiScaled(4) }; - points[4] = { points[3].x(), points[3].y() - QStyleHelper::dpiScaled(2) }; - points[5] = { points[4].x() - QStyleHelper::dpiScaled(4), points[4].y() + QStyleHelper::dpiScaled(4) }; + qreal scaleh = opt->rect.width() / 12.0; + qreal scalev = opt->rect.height() / 12.0; + points[0] = { opt->rect.x() + 3.5 * scaleh, opt->rect.y() + 5.5 * scalev }; + points[1] = { points[0].x(), points[0].y() + 2 * scalev }; + points[2] = { points[1].x() + 2 * scaleh, points[1].y() + 2 * scalev }; + points[3] = { points[2].x() + 4 * scaleh, points[2].y() - 4 * scalev }; + points[4] = { points[3].x(), points[3].y() - 2 * scalev }; + points[5] = { points[4].x() - 4 * scaleh, points[4].y() + 4 * scalev }; p->setPen(QPen(opt->palette.text().color(), 0)); p->setBrush(opt->palette.text().color()); p->drawPolygon(points, 6); |