diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-29 23:05:32 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-29 23:05:32 (GMT) |
commit | f5feea56fc7202ab64a1b9c5f9b05391c2b88238 (patch) | |
tree | 758b5baf983eabddea162f67c711dcf903358d9e | |
parent | 81e19a4621f59d893403a0b79770c4623efc5c3d (diff) | |
parent | c1759aa657f5f729c96696b819465c70266c21c8 (diff) | |
download | Qt-f5feea56fc7202ab64a1b9c5f9b05391c2b88238.zip Qt-f5feea56fc7202ab64a1b9c5f9b05391c2b88238.tar.gz Qt-f5feea56fc7202ab64a1b9c5f9b05391c2b88238.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public:
Fix QWidget::palettePropagation2() autotest on Symbian (part 2)
Fix QWidget::palettePropagation2() autotest on Symbian
-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 5699dbb..6b66a09 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" @@ -1433,12 +1434,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(); } |