From 95682718bff40c7beec6de14eb921f066304c0b7 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 9 Oct 2012 17:49:23 +0200 Subject: [PATCH] hint-scrollbar-size element for scrollbar width/height --- private/style.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/private/style.cpp b/private/style.cpp index adfa9bdee..182e35c8c 100644 --- a/private/style.cpp +++ b/private/style.cpp @@ -331,11 +331,21 @@ int Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWi switch (metric) { case PM_ScrollBarExtent: { d->createScrollbar(); + const QSizeF hintSize = d->scrollbar->elementSize("hint-scrollbar-size"); const QStyleOptionSlider *scrollOption = qstyleoption_cast(option); + if (scrollOption && scrollOption->orientation == Qt::Vertical) { - return d->scrollbar->elementSize("arrow-down").width() + 2; + if (hintSize.isEmpty()) { + return d->scrollbar->elementSize("arrow-down").width() + 2; + } else { + return hintSize.width(); + } } else { - return d->scrollbar->elementSize("arrow-left").height() + 2; + if (hintSize.isEmpty()) { + return d->scrollbar->elementSize("arrow-left").height() + 2; + } else { + return hintSize.height(); + } } } default: