From 9ef422955154199e6f2d5569cb4074a5967f53e9 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 5 Jul 2011 14:06:43 +0200 Subject: Lion Support: Fix QSpinBox look Also sets the read-only state in QStyleOptionSpinBox, wich wasn't before. Reviewed-by: Jens Bache-Wiig --- src/gui/styles/qmacstyle_mac.mm | 2 +- src/gui/widgets/qabstractspinbox.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index efe2e7d..321db25 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -4725,7 +4725,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex HIThemeFrameDrawInfo fdi; fdi.version = qt_mac_hitheme_version; - fdi.state = tds; + fdi.state = ((sb->state & State_ReadOnly) || !(sb->state & State_Enabled)) ? kThemeStateInactive : kThemeStateActive; fdi.kind = kHIThemeFrameTextFieldSquare; fdi.isFocused = false; HIRect hirect = qt_hirectForQRect(lineeditRect); diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index 4372ae3..7a985a1 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -1655,6 +1655,8 @@ void QAbstractSpinBox::initStyleOption(QStyleOptionSpinBox *option) const : (QAbstractSpinBox::StepDownEnabled|QAbstractSpinBox::StepUpEnabled); option->frame = d->frame; + if (d->readOnly) + option->state |= QStyle::State_ReadOnly; } /*! -- cgit v0.12