diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-10-15 14:05:24 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-10-22 08:58:42 +0200 |
commit | 763a48fe1af5b0482f929a79ded05ea21456a916 (patch) | |
tree | a35edb782fd9abba99ffbedc0ebe4d9a3a6161de /src/widgets/styles/qwindowsvistastyle.cpp | |
parent | ff98c440603e94ae284ad08d289418f4b5cca89e (diff) |
Windows XP style: Fix size calculation of QScrollBar's grip.
Factor out function to calculate the geometry for the styles >= XP.
Task-number: QTBUG-41944
Task-number: QTBUG-40277
Change-Id: Ifad1519b99fd587158c790dd241cb3e4bac3bfc3
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/widgets/styles/qwindowsvistastyle.cpp')
-rw-r--r-- | src/widgets/styles/qwindowsvistastyle.cpp | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 044394747c..007952192a 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -1756,26 +1756,8 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle theme.stateId = stateId; d->drawBackground(theme); - // Calculate rect of gripper - const int swidth = theme.rect.width(); - const int sheight = theme.rect.height(); - - const QMargins contentsMargin = theme.margins(theme.rect, TMT_SIZINGMARGINS) - / QWindowsXPStylePrivate::devicePixelRatio(widget); - - theme.partId = flags & State_Horizontal ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT; - const QSize size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget); - if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8) { - QPoint gripperBoundsPos(0, 0); - if ((flags & State_Horizontal - && swidth - contentsMargin.left() - contentsMargin.right() > size.width()) - || sheight - contentsMargin.top() - contentsMargin.bottom() > size.height()) { - gripperBoundsPos = QPoint(theme.rect.left() + (swidth - size.width()) / 2, - theme.rect.top() + (sheight - size.height()) / 2); - } - const QRect gripperBounds(gripperBoundsPos, size); - + const QRect gripperBounds = QWindowsXPStylePrivate::scrollBarGripperBounds(flags, widget, &theme); // Draw gripper if there is enough space if (!gripperBounds.isEmpty() && flags & State_Enabled) { painter->save(); |