diff options
Diffstat (limited to 'src/gui/styles/qs60style.cpp')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 93 |
1 files changed, 51 insertions, 42 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index bf73494..f3a5d97 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -541,46 +541,10 @@ void QS60StylePrivate::setThemePalette(QApplication *app) const app->setPalette(widgetPalette); } -void QS60StylePrivate::setBackgroundTexture(QApplication *app) const -{ - if (!app) - return; - QPalette applicationPalette = app->palette(); - applicationPalette.setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture()); - app->setPalette(applicationPalette); -} - -void QS60Style::polish(QApplication *application) +void QS60StylePrivate::setThemePalette(QWidget *widget) const { - Q_D(const QS60Style); - originalPalette = application->palette(); - d->setThemePalette(application); -} - -void QS60Style::polish(QWidget *widget) -{ - Q_D(const QS60Style); - QCommonStyle::polish(widget); - - if (!widget) + if(!widget) return; - - if (QS60StylePrivate::isSkinnableDialog(widget)) { - widget->setAttribute(Qt::WA_StyledBackground); - } else if (false -#ifndef QT_NO_MENU - || qobject_cast<const QMenu *> (widget) -#endif // QT_NO_MENU - ) { - widget->setAttribute(Qt::WA_StyledBackground); - } else if (false -#ifndef QT_NO_COMBOBOX - || qobject_cast<const QComboBoxListView *>(widget) -#endif //QT_NO_COMBOBOX - ) { - widget->setAttribute(Qt::WA_StyledBackground); - } - QPalette widgetPalette = widget->palette(); // widget specific colors and fonts @@ -589,16 +553,19 @@ void QS60Style::polish(QWidget *widget) QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0)); QApplication::setPalette(widgetPalette, "QSlider"); } else if (qobject_cast<QPushButton *>(widget)){ - const QFont suggestedFont = d->s60Font( + const QFont suggestedFont = s60Font( QS60StyleEnums::FC_Primary, widget->font().pointSizeF()); widget->setFont(suggestedFont); widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + const QStyleOption opt; + widgetPalette.setColor(QPalette::Disabled, QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, &opt)); QApplication::setPalette(widgetPalette, "QPushButton"); } else if (qobject_cast<QToolButton *>(widget)){ - const QFont suggestedFont = d->s60Font( + const QFont suggestedFont = s60Font( QS60StyleEnums::FC_Primary, widget->font().pointSizeF()); widget->setFont(suggestedFont); widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, @@ -607,7 +574,7 @@ void QS60Style::polish(QWidget *widget) QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); QApplication::setPalette(widgetPalette, "QToolButton"); } else if (qobject_cast<QHeaderView *>(widget)){ - const QFont suggestedFont = d->s60Font( + const QFont suggestedFont = s60Font( QS60StyleEnums::FC_Secondary, widget->font().pointSizeF()); widget->setFont(suggestedFont); widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, @@ -630,7 +597,7 @@ void QS60Style::polish(QWidget *widget) QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0)); QApplication::setPalette(widgetPalette, "QTableView"); } else if (qobject_cast<QGroupBox *>(widget)){ - const QFont suggestedFont = d->s60Font( + const QFont suggestedFont = s60Font( QS60StyleEnums::FC_Title, widget->font().pointSizeF()); widget->setFont(suggestedFont); } else if (qobject_cast<QLineEdit *>(widget)) { @@ -647,6 +614,48 @@ void QS60Style::polish(QWidget *widget) } } +void QS60StylePrivate::setBackgroundTexture(QApplication *app) const +{ + if (!app) + return; + QPalette applicationPalette = app->palette(); + applicationPalette.setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture()); + app->setPalette(applicationPalette); +} + +void QS60Style::polish(QApplication *application) +{ + Q_D(const QS60Style); + originalPalette = application->palette(); + d->setThemePalette(application); +} + +void QS60Style::polish(QWidget *widget) +{ + Q_D(const QS60Style); + QCommonStyle::polish(widget); + + if (!widget) + return; + + if (QS60StylePrivate::isSkinnableDialog(widget)) { + widget->setAttribute(Qt::WA_StyledBackground); + } else if (false +#ifndef QT_NO_MENU + || qobject_cast<const QMenu *> (widget) +#endif // QT_NO_MENU + ) { + widget->setAttribute(Qt::WA_StyledBackground); + } else if (false +#ifndef QT_NO_COMBOBOX + || qobject_cast<const QComboBoxListView *>(widget) +#endif //QT_NO_COMBOBOX + ) { + widget->setAttribute(Qt::WA_StyledBackground); + } + d->setThemePalette(widget); +} + void QS60Style::unpolish(QApplication *application) { application->setPalette(originalPalette); |