diff --git a/private/style.cpp b/private/style.cpp index 9de800f6e..d471ab8bd 100644 --- a/private/style.cpp +++ b/private/style.cpp @@ -137,6 +137,22 @@ void Style::drawComplexControl(ComplexControl control, painter->restore(); } +int Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const +{ + switch (metric) { + case PM_ScrollBarExtent: { + const QStyleOptionSlider *scrollOption = qstyleoption_cast(option); + if (scrollOption && scrollOption->orientation == Qt::Vertical) { + return d->scrollbar->elementSize("arrow-down").width() + 2; + } else { + return d->scrollbar->elementSize("arrow-left").height() + 2; + } + } + default: + return QCommonStyle::pixelMetric(metric, option, widget); + } +} + } #include "style_p.moc" diff --git a/private/style_p.h b/private/style_p.h index dbd0fb790..c2dc2ea9c 100644 --- a/private/style_p.h +++ b/private/style_p.h @@ -41,6 +41,8 @@ protected: const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const; + + int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; private: StylePrivate *d; }; diff --git a/widgets/scrollbar.cpp b/widgets/scrollbar.cpp index e359d87da..b1dd0697d 100644 --- a/widgets/scrollbar.cpp +++ b/widgets/scrollbar.cpp @@ -40,6 +40,8 @@ ScrollBar::ScrollBar(Qt::Orientation orientation, QGraphicsWidget *parent) setWidget(scrollbar); d->style = new Plasma::Style(); scrollbar->setStyle(d->style); + + scrollbar->resize(scrollbar->sizeHint()); } ScrollBar::~ScrollBar()