hint-scrollbar-size element for scrollbar width/height

This commit is contained in:
Marco Martin 2012-10-09 17:49:23 +02:00
parent 957caaae77
commit 95682718bf

View File

@ -331,11 +331,21 @@ int Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWi
switch (metric) { switch (metric) {
case PM_ScrollBarExtent: { case PM_ScrollBarExtent: {
d->createScrollbar(); d->createScrollbar();
const QSizeF hintSize = d->scrollbar->elementSize("hint-scrollbar-size");
const QStyleOptionSlider *scrollOption = qstyleoption_cast<const QStyleOptionSlider *>(option); const QStyleOptionSlider *scrollOption = qstyleoption_cast<const QStyleOptionSlider *>(option);
if (scrollOption && scrollOption->orientation == Qt::Vertical) { if (scrollOption && scrollOption->orientation == Qt::Vertical) {
if (hintSize.isEmpty()) {
return d->scrollbar->elementSize("arrow-down").width() + 2; return d->scrollbar->elementSize("arrow-down").width() + 2;
} else { } else {
return hintSize.width();
}
} else {
if (hintSize.isEmpty()) {
return d->scrollbar->elementSize("arrow-left").height() + 2; return d->scrollbar->elementSize("arrow-left").height() + 2;
} else {
return hintSize.height();
}
} }
} }
default: default: