use elements dimensions to resize the scrollbar
svn path=/trunk/KDE/kdelibs/; revision=893050
This commit is contained in:
parent
2952fe3e5f
commit
b47c32869f
@ -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<const QStyleOptionSlider *>(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"
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user