summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qmacstyle_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/styles/qmacstyle_mac.mm')
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index a8fba4fb68..f8905b1b1a 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -119,9 +119,12 @@ QMacStylePrivate *mPrivate;
{
Q_UNUSED(notification);
QEvent event(QEvent::StyleChange);
- foreach (QWidget *widget, QApplication::allWidgets()) {
- if (QScrollBar *scrollBar = qobject_cast<QScrollBar *>(widget))
- QCoreApplication::sendEvent(scrollBar, &event);
+ QMutableSetIterator<QPointer<QObject> > it(QMacStylePrivate::scrollBars);
+ while (it.hasNext()) {
+ if (!it.next())
+ it.remove();
+ else
+ QCoreApplication::sendEvent(it.value(), &event);
}
}
@end
@@ -142,6 +145,13 @@ const int QMacStylePrivate::PushButtonContentPadding = 6;
const qreal QMacStylePrivate::ScrollBarFadeOutDuration = 200.0;
const qreal QMacStylePrivate::ScrollBarFadeOutDelay = 450.0;
+QSet<QPointer<QObject> > QMacStylePrivate::scrollBars;
+
+static uint qHash(const QPointer<QObject> &ptr)
+{
+ return qHash(ptr.data());
+}
+
// These colors specify the titlebar gradient colors on
// Leopard. Ideally we should get them from the system.
static const QColor titlebarGradientActiveBegin(220, 220, 220);
@@ -4934,6 +4944,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
// no longer possible to move it, second the up/down buttons are removed when
// there is not enough space for them.
if (cc == CC_ScrollBar) {
+ if (opt && opt->styleObject && !QMacStylePrivate::scrollBars.contains(opt->styleObject))
+ QMacStylePrivate::scrollBars.insert(QPointer<QObject>(opt->styleObject));
const int scrollBarLength = (slider->orientation == Qt::Horizontal)
? slider->rect.width() : slider->rect.height();
const QMacStyle::WidgetSizePolicy sizePolicy = widgetSizePolicy(widget, opt);
@@ -6021,10 +6033,14 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
bool useAquaGuideline = true;
switch (ct) {
- case QStyle::CT_SpinBox:
- // hack to work around horrible sizeHint() code in QAbstractSpinBox
- sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);
- sz.setHeight(sz.height() - 3);
+
+ case CT_SpinBox:
+ if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
+ // Add button + frame widths
+ int buttonWidth = 20;
+ int fw = proxy()->pixelMetric(PM_SpinBoxFrameWidth, vopt, widget);
+ sz += QSize(buttonWidth + 2*fw, 2*fw - 3);
+ }
break;
case QStyle::CT_TabWidget:
// the size between the pane and the "contentsRect" (+4,+4)