static int getControlSize(const QStyleOption *option, const QWidget *widget)
{
- if (option) {
- if (option->state & (QStyle::State_Small | QStyle::State_Mini))
- return (option->state & QStyle::State_Mini) ? QAquaSizeMini : QAquaSizeSmall;
- } else if (widget) {
- switch (QMacStyle::widgetSizePolicy(widget)) {
- case QMacStyle::SizeSmall:
- return QAquaSizeSmall;
- case QMacStyle::SizeMini:
- return QAquaSizeMini;
- default:
- break;
- }
+ switch (QMacStyle::widgetSizePolicy(widget, option)) {
+ case QMacStyle::SizeSmall:
+ return QAquaSizeSmall;
+ case QMacStyle::SizeMini:
+ return QAquaSizeMini;
+ default:
+ break;
}
return QAquaSizeLarge;
}
tdi->reserved = 0;
tdi->filler1 = 0;
bool isScrollbar = (cc == QStyle::CC_ScrollBar);
- switch (aquaSizeConstrain(0, needToRemoveMe)) {
+ switch (aquaSizeConstrain(slider, needToRemoveMe)) {
case QAquaSizeUnknown:
case QAquaSizeLarge:
if (isScrollbar)
wadget->setAttribute(Qt::WA_MacMiniSize, policy == SizeMini);
}
-QMacStyle::WidgetSizePolicy QMacStyle::widgetSizePolicy(const QWidget *widget)
+QMacStyle::WidgetSizePolicy QMacStyle::widgetSizePolicy(const QWidget *widget, const QStyleOption *opt)
{
while (widget) {
if (widget->testAttribute(Qt::WA_MacMiniSize)) {
}
widget = widget->parentWidget();
}
+
+ if (opt && opt->state & State_Mini)
+ return SizeMini;
+ else if (opt && opt->state & State_Small)
+ return SizeSmall;
+
return SizeDefault;
}
if (cc == CC_ScrollBar) {
const int scrollBarLength = (slider->orientation == Qt::Horizontal)
? slider->rect.width() : slider->rect.height();
- const QMacStyle::WidgetSizePolicy sizePolicy = widgetSizePolicy(widget);
+ const QMacStyle::WidgetSizePolicy sizePolicy = widgetSizePolicy(widget, opt);
if (scrollBarLength < scrollButtonsCutoffSize(thumbIndicatorCutoff, sizePolicy))
tdi.attributes &= ~kThemeTrackShowThumb;
if (scrollBarLength < scrollButtonsCutoffSize(scrollButtonsCutoff, sizePolicy))
// exclude them from the hit test.
const int scrollBarLength = (sb->orientation == Qt::Horizontal)
? sb->rect.width() : sb->rect.height();
- if (scrollBarLength < scrollButtonsCutoffSize(scrollButtonsCutoff, widgetSizePolicy(widget)))
+ if (scrollBarLength < scrollButtonsCutoffSize(scrollButtonsCutoff, widgetSizePolicy(widget, opt)))
sbi.enableState = kThemeTrackNothingToScroll;
sbi.viewsize = sb->pageStep;
case CT_ScrollBar :
// Make sure that the scroll bar is large enough to display the thumb indicator.
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
- const int minimumSize = scrollButtonsCutoffSize(thumbIndicatorCutoff, widgetSizePolicy(widget));
+ const int minimumSize = scrollButtonsCutoffSize(thumbIndicatorCutoff, widgetSizePolicy(widget, opt));
if (slider->orientation == Qt::Horizontal)
sz = sz.expandedTo(QSize(minimumSize, sz.height()));
else