diff options
author | Liang Qi <liang.qi@nokia.com> | 2011-07-01 07:00:13 (GMT) |
---|---|---|
committer | Liang Qi <liang.qi@nokia.com> | 2011-07-01 07:00:13 (GMT) |
commit | 3dc0c38389670d6adddd972c532af98dd6b5deb5 (patch) | |
tree | 779945938b51cc6290bc6dcee1cb34f696f42242 /src/gui/styles/qs60style_s60.cpp | |
parent | 73f0d9534b593c65e4facf9a975e2c2e63608f03 (diff) | |
parent | f5feea56fc7202ab64a1b9c5f9b05391c2b88238 (diff) | |
download | Qt-3dc0c38389670d6adddd972c532af98dd6b5deb5.zip Qt-3dc0c38389670d6adddd972c532af98dd6b5deb5.tar.gz Qt-3dc0c38389670d6adddd972c532af98dd6b5deb5.tar.bz2 |
Merge remote-tracking branch 'origin/4.7' into qt-4.8-from-4.7
Conflicts:
src/s60installs/s60installs.pro
Diffstat (limited to 'src/gui/styles/qs60style_s60.cpp')
-rw-r--r-- | src/gui/styles/qs60style_s60.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 2d2710c..14fdbd3 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -44,6 +44,7 @@ #include "qpainter.h" #include "qstyleoption.h" #include "qstyle.h" +#include "private/qapplication_p.h" #include "private/qt_s60_p.h" #include "private/qpixmap_raster_symbian_p.h" #include "private/qcore_symbian_p.h" @@ -1387,12 +1388,26 @@ QPixmap QS60StylePrivate::backgroundTexture(bool skipCreation) // Notify all widgets that palette is updated with the actual background texture. QPalette pal = QApplication::palette(); pal.setBrush(QPalette::Window, *m_background); + + //Application palette hash is automatically cleared when QApplication::setPalette is called. + //To avoid losing palette hash data, back it up before calling the setPalette() API and + //restore it afterwards. + typedef QHash<QByteArray, QPalette> PaletteHash; + PaletteHash hash; + if (qt_app_palettes_hash() || !qt_app_palettes_hash()->isEmpty()) + hash = *qt_app_palettes_hash(); QApplication::setPalette(pal); - setThemePaletteHash(&pal); + if (hash.isEmpty()) { + //set default theme palette hash + setThemePaletteHash(&pal); + } else { + for (int i = 0; i < hash.count() - 1; i++) { + QByteArray widgetClassName = hash.keys().at(i); + QApplication::setPalette(hash.value(widgetClassName), widgetClassName); + } + } storeThemePalette(&pal); - foreach (QWidget *widget, QApplication::allWidgets()){ - QEvent e(QEvent::PaletteChange); - QApplication::sendEvent(widget, &e); + foreach (QWidget *widget, QApplication::allWidgets()) { setThemePalette(widget); widget->ensurePolished(); } |