diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-04-05 12:51:10 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-04-08 18:42:30 +0000 |
commit | 6accc102d3300986fcfa7417d3371f6556f8361a (patch) | |
tree | dcf152d729b80b490cc69a0448700b3b36e3c15a /src/widgets/styles | |
parent | 58b4e0736919e0504f5ca5307ad7aefa894a6f38 (diff) |
QStyle/QWidget: Avoid repetitive invocation of QStyleHelper::dpiScaled()
Store the result of QStyleHelper::dpiScaled() or functions dependent on it
in a variable, preparing the addition of a DPI parameter.
Task-number: QTBUG-45055
Change-Id: Ic70d65b590793c29a4b1f7a7a5312dd169517fc5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qwindowsstyle.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 4e450813cb..7b5da9bfa8 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -802,8 +802,10 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPen oldPen = p->pen(); p->setPen(QPen(opt->palette.shadow().color(), 0)); QRectF rect = opt->rect; - rect.adjust(QStyleHelper::dpiScaled(0.5), QStyleHelper::dpiScaled(0.5), - QStyleHelper::dpiScaled(-1.5), QStyleHelper::dpiScaled(-1.5)); + const qreal topLevelAdjustment = QStyleHelper::dpiScaled(0.5); + const qreal bottomRightAdjustment = QStyleHelper::dpiScaled(-1.5); + rect.adjust(topLevelAdjustment, topLevelAdjustment, + bottomRightAdjustment, bottomRightAdjustment); p->drawRect(rect); p->setPen(oldPen); break; |