diff options
Diffstat (limited to 'src/gui/styles/qs60style.cpp')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 403 |
1 files changed, 195 insertions, 208 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 1d4fb3f..f7a1700 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -126,6 +126,8 @@ const short *QS60StylePrivate::m_pmPointer = QS60StylePrivate::data[0]; // theme background texture QPixmap *QS60StylePrivate::m_background = 0; +QPalette *QS60StylePrivate::m_themePalette = 0; + const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameElementsData[] = { {SE_ButtonNormal, QS60StyleEnums::SP_QsnFrButtonTbCenter}, {SE_ButtonPressed, QS60StyleEnums::SP_QsnFrButtonTbCenterPressed}, @@ -149,7 +151,8 @@ const int KNotFound = -1; QS60StylePrivate::~QS60StylePrivate() { - deleteBackground(); + clearCaches(); //deletes also background image + delete m_themePalette; } void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, @@ -321,7 +324,7 @@ QVariant QS60StylePrivate::styleProperty(const char *name) const return QVariant(); } -QColor QS60StylePrivate::stateColor(const QColor& color, const QStyleOption *option) +QColor QS60StylePrivate::stateColor(const QColor &color, const QStyleOption *option) { QColor retColor (color); if (option && !(option->state & QStyle::State_Enabled)) { @@ -476,116 +479,18 @@ void QS60StylePrivate::setThemePalette(QApplication *app) const return; QPalette widgetPalette = QPalette(Qt::white); - - // basic colors - widgetPalette.setColor(QPalette::WindowText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::Text, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::ToolTipText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 55, 0)); - widgetPalette.setColor(QPalette::BrightText, widgetPalette.color(QPalette::WindowText).lighter()); - widgetPalette.setColor(QPalette::HighlightedText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0)); - widgetPalette.setColor(QPalette::Link, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 3, 0)); - widgetPalette.setColor(QPalette::LinkVisited, widgetPalette.color(QPalette::Link).darker()); - widgetPalette.setColor(QPalette::Highlight, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0)); - // set these as transparent so that styled full screen theme background is visible - widgetPalette.setColor(QPalette::AlternateBase, Qt::transparent); - widgetPalette.setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture()); - widgetPalette.setColor(QPalette::Base, Qt::transparent); - // set button and tooltipbase based on pixel colors - const QColor buttonColor = colorFromFrameGraphics(QS60StylePrivate::SF_ButtonNormal); - widgetPalette.setColor(QPalette::Button, buttonColor ); - widgetPalette.setColor(QPalette::Light, widgetPalette.color(QPalette::Button).lighter()); - widgetPalette.setColor(QPalette::Dark, widgetPalette.color(QPalette::Button).darker()); - widgetPalette.setColor(QPalette::Midlight, widgetPalette.color(QPalette::Button).lighter(125)); - widgetPalette.setColor(QPalette::Mid, widgetPalette.color(QPalette::Button).darker(150)); - widgetPalette.setColor(QPalette::Shadow, Qt::black); - QColor toolTipColor = colorFromFrameGraphics(QS60StylePrivate::SF_ToolTip); - widgetPalette.setColor(QPalette::ToolTipBase, toolTipColor ); - + setThemePalette(&widgetPalette); app->setPalette(widgetPalette); } -void QS60StylePrivate::setThemePalette(QWidget *widget) const +void QS60StylePrivate::setThemePalette(QStyleOption *option) const { - if(!widget) - return; - QPalette widgetPalette = widget->palette(); + setThemePalette(&option->palette); +} - // widget specific colors and fonts - if (qobject_cast<QSlider *>(widget)){ - widgetPalette.setColor(QPalette::All, QPalette::WindowText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0)); - QApplication::setPalette(widgetPalette, "QSlider"); - } else if (qobject_cast<QPushButton *>(widget)){ - 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 = 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)); - QApplication::setPalette(widgetPalette, "QToolButton"); - } else if (qobject_cast<QHeaderView *>(widget)){ - const QFont suggestedFont = s60Font( - QS60StyleEnums::FC_Secondary, widget->font().pointSizeF()); - widget->setFont(suggestedFont); - widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0)); - QHeaderView* header = qobject_cast<QHeaderView *>(widget); - widgetPalette.setColor(QPalette::Button, Qt::transparent ); - if ( header->viewport() ) - header->viewport()->setPalette(widgetPalette); - QApplication::setPalette(widgetPalette, "QHeaderView"); - } else if (qobject_cast<QMenuBar *>(widget)){ - widgetPalette.setColor(QPalette::All, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0)); - QApplication::setPalette(widgetPalette, "QMenuBar"); - } else if (qobject_cast<QTabBar *>(widget)){ - widgetPalette.setColor(QPalette::Active, QPalette::WindowText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0)); - QApplication::setPalette(widgetPalette, "QTabBar"); - } else if (qobject_cast<QTableView *>(widget)){ - widgetPalette.setColor(QPalette::All, QPalette::Text, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0)); - QApplication::setPalette(widgetPalette, "QTableView"); - } else if (qobject_cast<QGroupBox *>(widget)){ - const QFont suggestedFont = s60Font( - QS60StyleEnums::FC_Title, widget->font().pointSizeF()); - widget->setFont(suggestedFont); - } else if (qobject_cast<QLineEdit *>(widget)) { - widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); - QApplication::setPalette(widgetPalette, "QLineEdit"); - } else if (qobject_cast<QDial *> (widget)) { - const QColor color(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::WindowText, color); - widgetPalette.setColor(QPalette::Button, QApplication::palette().color(QPalette::Button)); - widgetPalette.setColor(QPalette::Dark, color.darker()); - widgetPalette.setColor(QPalette::Light, color.lighter()); - QApplication::setPalette(widgetPalette, "QDial"); - } else if (qobject_cast<QScrollArea *>(widget)) { - widgetPalette.setBrush(QPalette::Window, QBrush()); - QApplication::setPalette(widgetPalette, "QScrollArea"); - } +QPalette* QS60StylePrivate::themePalette() +{ + return m_themePalette; } void QS60StylePrivate::setBackgroundTexture(QApplication *app) const @@ -710,15 +615,186 @@ QPixmap QS60StylePrivate::cachedFrame(SkinFrameElements frame, const QSize &size void QS60StylePrivate::refreshUI() { - foreach (QWidget *topLevelWidget, QApplication::allWidgets()) { - topLevelWidget->updateGeometry(); - //todo: study how we can get rid of this. Apparently scrollbars cache pixelmetrics values, and we need them to update themselves - // maybe styleChanged event is enough? - //QCoreApplication::postEvent(topLevelWidget, new QEvent(QEvent::StyleChange)); - QCoreApplication::postEvent(topLevelWidget, new QResizeEvent(topLevelWidget->size(), topLevelWidget->size())); + QList<QWidget *> widgets = QApplication::allWidgets(); + + // The following is similar to updateWidgets in qstylesheetstyle.cpp. + + for (int i = 0; i < widgets.size(); ++i) { + QWidget *widget = widgets.at(i); + if (widget == 0) + continue; + + if (widget->style()) { + widget->style()->polish(widget); + QEvent event(QEvent::StyleChange); + qApp->sendEvent(widget, &event); + } + widget->update(); + widget->updateGeometry(); + } +} + +void QS60StylePrivate::setFont(QWidget *widget) const +{ + QS60StyleEnums::FontCategories fontCategory = QS60StyleEnums::FC_Undefined; + if (!widget) + return; + if (qobject_cast<QPushButton *>(widget)){ + fontCategory = QS60StyleEnums::FC_Primary; + } else if (qobject_cast<QToolButton *>(widget)){ + fontCategory = QS60StyleEnums::FC_Primary; + } else if (qobject_cast<QHeaderView *>(widget)){ + fontCategory = QS60StyleEnums::FC_Secondary; + } else if (qobject_cast<QGroupBox *>(widget)){ + fontCategory = QS60StyleEnums::FC_Title; + } + if (fontCategory != QS60StyleEnums::FC_Undefined) { + const QFont suggestedFont = + s60Font(fontCategory, widget->font().pointSizeF()); + widget->setFont(suggestedFont); } } +void QS60StylePrivate::setThemePalette(QWidget *widget) const +{ + if(!widget) + return; + QPalette widgetPalette = widget->palette(); + + //header view and its viewport need to be set 100% transparent button color, since drawing code will + //draw transparent theme graphics there. + if (qobject_cast<QHeaderView *>(widget)){ + widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0)); + QHeaderView* header = qobject_cast<QHeaderView *>(widget); + widgetPalette.setColor(QPalette::Button, Qt::transparent ); + if ( header->viewport() ) + header->viewport()->setPalette(widgetPalette); + QApplication::setPalette(widgetPalette, "QHeaderView"); + } +} + +void QS60StylePrivate::setThemePalette(QPalette *palette) const +{ + if (!palette) + return; + + // basic colors + palette->setColor(QPalette::WindowText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + palette->setColor(QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + palette->setColor(QPalette::Text, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + palette->setColor(QPalette::ToolTipText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 55, 0)); + palette->setColor(QPalette::BrightText, palette->color(QPalette::WindowText).lighter()); + palette->setColor(QPalette::HighlightedText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0)); + palette->setColor(QPalette::Link, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 3, 0)); + palette->setColor(QPalette::LinkVisited, palette->color(QPalette::Link).darker()); + palette->setColor(QPalette::Highlight, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0)); + // set these as transparent so that styled full screen theme background is visible + palette->setColor(QPalette::AlternateBase, Qt::transparent); + palette->setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture()); + palette->setColor(QPalette::Base, Qt::transparent); + // set button and tooltipbase based on pixel colors + const QColor buttonColor = this->colorFromFrameGraphics(QS60StylePrivate::SF_ButtonNormal); + palette->setColor(QPalette::Button, buttonColor ); + palette->setColor(QPalette::Light, palette->color(QPalette::Button).lighter()); + palette->setColor(QPalette::Dark, palette->color(QPalette::Button).darker()); + palette->setColor(QPalette::Midlight, palette->color(QPalette::Button).lighter(125)); + palette->setColor(QPalette::Mid, palette->color(QPalette::Button).darker(150)); + palette->setColor(QPalette::Shadow, Qt::black); + QColor toolTipColor = this->colorFromFrameGraphics(QS60StylePrivate::SF_ToolTip); + palette->setColor(QPalette::ToolTipBase, toolTipColor ); + + setThemePaletteHash(palette); + QS60StylePrivate::storeThemePalette(palette); +} + +void QS60StylePrivate::storeThemePalette(QPalette *palette) +{ + //store specified palette for latter use. + if (m_themePalette) { + delete m_themePalette; + m_themePalette = 0; + } + m_themePalette = new QPalette(*palette); +} + +// set widget specific palettes +void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const +{ + if (!palette) + return; + + //store the original palette + QPalette widgetPalette = *palette; + + widgetPalette.setColor(QPalette::All, QPalette::WindowText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0)); + QApplication::setPalette(widgetPalette, "QSlider"); + // return to original palette after each widget + widgetPalette = *palette; + + 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"); + widgetPalette = *palette; + + 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)); + QApplication::setPalette(widgetPalette, "QToolButton"); + widgetPalette = *palette; + + widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0)); + QApplication::setPalette(widgetPalette, "QHeaderView"); + widgetPalette = *palette; + + widgetPalette.setColor(QPalette::All, QPalette::ButtonText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0)); + QApplication::setPalette(widgetPalette, "QMenuBar"); + widgetPalette = *palette; + + widgetPalette.setColor(QPalette::Active, QPalette::WindowText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0)); + QApplication::setPalette(widgetPalette, "QTabBar"); + widgetPalette = *palette; + + widgetPalette.setColor(QPalette::All, QPalette::Text, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0)); + QApplication::setPalette(widgetPalette, "QTableView"); + widgetPalette = *palette; + + widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); + QApplication::setPalette(widgetPalette, "QLineEdit"); + widgetPalette = *palette; + + const QColor color(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + widgetPalette.setColor(QPalette::WindowText, color); + widgetPalette.setColor(QPalette::Button, QApplication::palette().color(QPalette::Button)); + widgetPalette.setColor(QPalette::Dark, color.darker()); + widgetPalette.setColor(QPalette::Light, color.lighter()); + QApplication::setPalette(widgetPalette, "QDial"); + widgetPalette = *palette; + + widgetPalette.setBrush(QPalette::Window, QBrush()); + QApplication::setPalette(widgetPalette, "QScrollArea"); + widgetPalette = *palette; +} + QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlags flags) { QSize result(20, 20); @@ -1141,15 +1217,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom } break; #endif //QT_NO_GROUPBOX -#ifndef QT_NO_DIAL - case CC_Dial: - if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - QStyleOptionSlider optionSlider = *slider; - QCommonStyle::drawComplexControl(control, &optionSlider, painter, widget); - } - break; -#endif //QT_NO_DIAL - default: QCommonStyle::drawComplexControl(control, option, painter, widget); } @@ -1207,24 +1274,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); } break; - case CE_PushButtonLabel: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QStyleOptionButton optionButton = *button; - QCommonStyle::drawControl(element, &optionButton, painter, widget); - } - break; - case CE_CheckBoxLabel: - if (const QStyleOptionButton *checkBox = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QStyleOptionButton optionCheckBox = *checkBox; - QCommonStyle::drawControl(element, &optionCheckBox, painter, widget); - } - break; - case CE_RadioButtonLabel: - if (const QStyleOptionButton *radioButton = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QStyleOptionButton optionRadioButton = *radioButton; - QCommonStyle::drawControl(element, &optionRadioButton, painter, widget); - } - break; #ifndef QT_NO_TOOLBUTTON case CE_ToolButtonLabel: if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { @@ -1243,12 +1292,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } break; #endif //QT_NO_TOOLBUTTON - case CE_HeaderLabel: - if (const QStyleOptionHeader *headerLabel = qstyleoption_cast<const QStyleOptionHeader *>(option)) { - QStyleOptionHeader optionHeaderLabel = *headerLabel; - QCommonStyle::drawControl(element, &optionHeaderLabel, painter, widget); - } - break; #ifndef QT_NO_COMBOBOX case CE_ComboBoxLabel: if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { @@ -1610,12 +1653,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, break; #endif // QT_NO_PROGRESSBAR #ifndef QT_NO_MENUBAR - case CE_MenuBarItem: - if (const QStyleOptionMenuItem *menuBarItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { - QStyleOptionMenuItem optionMenuBarItem = *menuBarItem; - QCommonStyle::drawControl(element, &optionMenuBarItem, painter, widget); - } - break; #endif //QT_NO_MENUBAR #ifndef QT_NO_MENU case CE_MenuItem: @@ -1828,49 +1865,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } break; #endif //QT_NO_TOOLBAR - - //todo: remove non-used widgets in final version - case CE_ShapedFrame: - case CE_MenuVMargin: - case CE_MenuHMargin: -#ifndef QT_NO_MENU - case CE_MenuScroller: - case CE_MenuTearoff: -#endif //QT_NO_MENU - - case CE_CheckBox: - case CE_RadioButton: -#ifndef QT_NO_TABBAR - case CE_TabBarTab: -#endif //QT_NO_TABBAR -#ifndef QT_NO_PROGRESSBAR - case CE_ProgressBar: -#endif // QT_NO_PROGRESSBAR - case CE_Q3DockWindowEmptyArea: -#ifndef QT_NO_SIZEGRIP - case CE_SizeGrip: -#endif //QT_NO_SIZEGRIP - case CE_Splitter: -#ifndef QT_NO_RUBBERBAND - case CE_RubberBand: -#endif //QT_NO_RUBBERBAND -#ifndef QT_NO_DOCKWIDGET - case CE_DockWidgetTitle: -#endif //QT_NO_DOCKWIDGET - case CE_ScrollBarAddLine: - case CE_ScrollBarSubLine: - case CE_ScrollBarAddPage: - case CE_ScrollBarSubPage: - case CE_ScrollBarSlider: - case CE_ScrollBarFirst: - case CE_ScrollBarLast: - case CE_FocusFrame: -#ifndef QT_NO_TOOLBOX - case CE_ToolBoxTab: - case CE_ToolBoxTabShape: - case CE_ToolBoxTabLabel: -#endif //QT_NO_TOOLBOX - case CE_ColumnViewGrip: default: QCommonStyle::drawControl(element, option, painter, widget); } @@ -2199,15 +2193,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti } /*! - \reimp - sets the default colors -*/ -void QS60Style::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette & palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const -{ - QPalette override = palette; - QCommonStyle::drawItemText(painter, rectangle, alignment, override, enabled, text, textRole); -} - -/*! \reimp */ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const @@ -2673,6 +2658,7 @@ void QS60Style::polish(QWidget *widget) widget->setAttribute(Qt::WA_StyledBackground); } d->setThemePalette(widget); + d->setFont(widget); } void QS60Style::unpolish(QWidget *widget) @@ -2710,17 +2696,18 @@ void QS60Style::unpolish(QWidget *widget) void QS60Style::polish(QApplication *application) { - Q_D(const QS60Style); - originalPalette = application->palette(); + Q_D(QS60Style); + d->m_originalPalette = application->palette(); d->setThemePalette(application); } void QS60Style::unpolish(QApplication *application) { Q_UNUSED(application) - QPalette newPalette = qApp->style()->standardPalette(); + Q_D(QS60Style); + const QPalette newPalette = QApplication::style()->standardPalette(); application->setPalette(newPalette); - QApplicationPrivate::setSystemPalette(originalPalette); + QApplicationPrivate::setSystemPalette(d->m_originalPalette); } void QS60Style::setStyleProperty(const char *name, const QVariant &value) |