diff options
author | J-P Nurmi <jpnurmi@gmail.com> | 2013-08-22 19:51:48 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-23 14:26:42 (GMT) |
commit | 721d04eb3b1a8a1daa3d0206adaeb01f652170c7 (patch) | |
tree | be4e43d2a4a5f981c2eccfa9d0b5823af9567f3f | |
parent | af9ecedd523e5d41983160a9832bb8d90a1c5391 (diff) | |
download | Qt-721d04eb3b1a8a1daa3d0206adaeb01f652170c7.zip Qt-721d04eb3b1a8a1daa3d0206adaeb01f652170c7.tar.gz Qt-721d04eb3b1a8a1daa3d0206adaeb01f652170c7.tar.bz2 |
Fix scrollbar appearance on Win8
(Cherry-picked from qtbase/61948f84da12432b9b8b178875a86f54fef12e32)
Task-number: QTBUG-26503
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Change-Id: I1ff92e9f2825e9c0171dbbf5425bb2c997d9cf5a
-rw-r--r-- | src/gui/styles/qwindowsvistastyle.cpp | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index 47cce9f..4008ab1 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -1842,30 +1842,31 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size); int gw = size.cx, gh = size.cy; + if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8) { + QRect gripperBounds; + if (flags & State_Horizontal && ((swidth - contentsMargin.cxLeftWidth - contentsMargin.cxRightWidth) > gw)) { + gripperBounds.setLeft(theme.rect.left() + swidth/2 - gw/2); + gripperBounds.setTop(theme.rect.top() + sheight/2 - gh/2); + gripperBounds.setWidth(gw); + gripperBounds.setHeight(gh); + } else if ((sheight - contentsMargin.cyTopHeight - contentsMargin.cyBottomHeight) > gh) { + gripperBounds.setLeft(theme.rect.left() + swidth/2 - gw/2); + gripperBounds.setTop(theme.rect.top() + sheight/2 - gh/2); + gripperBounds.setWidth(gw); + gripperBounds.setHeight(gh); + } - QRect gripperBounds; - if (flags & State_Horizontal && ((swidth - contentsMargin.cxLeftWidth - contentsMargin.cxRightWidth) > gw)) { - gripperBounds.setLeft(theme.rect.left() + swidth/2 - gw/2); - gripperBounds.setTop(theme.rect.top() + sheight/2 - gh/2); - gripperBounds.setWidth(gw); - gripperBounds.setHeight(gh); - } else if ((sheight - contentsMargin.cyTopHeight - contentsMargin.cyBottomHeight) > gh) { - gripperBounds.setLeft(theme.rect.left() + swidth/2 - gw/2); - gripperBounds.setTop(theme.rect.top() + sheight/2 - gh/2); - gripperBounds.setWidth(gw); - gripperBounds.setHeight(gh); - } - - // Draw gripper if there is enough space - if (!gripperBounds.isEmpty() && flags & State_Enabled) { - painter->save(); - XPThemeData grippBackground = theme; - grippBackground.partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT; - theme.rect = gripperBounds; - painter->setClipRegion(d->region(theme));// Only change inside the region of the gripper - d->drawBackground(grippBackground);// The gutter is the grippers background - d->drawBackground(theme); // Transparent gripper ontop of background - painter->restore(); + // Draw gripper if there is enough space + if (!gripperBounds.isEmpty() && flags & State_Enabled) { + painter->save(); + XPThemeData grippBackground = theme; + grippBackground.partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT; + theme.rect = gripperBounds; + painter->setClipRegion(d->region(theme));// Only change inside the region of the gripper + d->drawBackground(grippBackground);// The gutter is the grippers background + d->drawBackground(theme); // Transparent gripper ontop of background + painter->restore(); + } } } } |