summaryrefslogtreecommitdiffstats
path: root/src/gui/styles/qs60style_s60.cpp
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2011-03-22 08:10:13 (GMT)
committerSami Merila <sami.merila@nokia.com>2011-03-22 08:10:13 (GMT)
commit6733b02876d0f305691e6fc8060502bb3d783c36 (patch)
tree8b9d9611eee494a01ce513c097310457b0a45109 /src/gui/styles/qs60style_s60.cpp
parentce61e3c3c6ff7f00d9b756c99e8fc031a69e68db (diff)
downloadQt-6733b02876d0f305691e6fc8060502bb3d783c36.zip
Qt-6733b02876d0f305691e6fc8060502bb3d783c36.tar.gz
Qt-6733b02876d0f305691e6fc8060502bb3d783c36.tar.bz2
QS60Style: Update placeholder texture to real one
Once the background texture has been created, update it to all widgets. This corrects most cases where texture is used outside of QS60Style. It is still possible to access the placeholder texture and draw it, if: a) QPalette::Window is accessed before drawing even one widget b) Painting the texture happens without using QS60Style Task-number: QTBUG-14910 Reviewed-by: Laszlo Agocs
Diffstat (limited to 'src/gui/styles/qs60style_s60.cpp')
-rw-r--r--src/gui/styles/qs60style_s60.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index e46c826..c5149a3 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -1391,7 +1391,7 @@ QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size, Skin
return result;
}
-QPixmap QS60StylePrivate::backgroundTexture()
+QPixmap QS60StylePrivate::backgroundTexture(bool skipCreation)
{
bool createNewBackground = false;
TRect applicationRect = (static_cast<CEikAppUi*>(S60->appUi())->ApplicationRect());
@@ -1406,21 +1406,36 @@ QPixmap QS60StylePrivate::backgroundTexture()
}
}
- if (createNewBackground) {
+ if (createNewBackground && !skipCreation) {
QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen,
QSize(applicationRect.Width(), applicationRect.Height()), 0, SkinElementFlags());
m_background = new QPixmap(background);
+
+ // Notify all widgets that palette is updated with the actual background texture.
+ QPalette pal = QApplication::palette();
+ pal.setBrush(QPalette::Window, *m_background);
+ QApplication::setPalette(pal);
+ setThemePaletteHash(&pal);
+ storeThemePalette(&pal);
+ foreach (QWidget *widget, QApplication::allWidgets()){
+ QEvent e(QEvent::PaletteChange);
+ QApplication::sendEvent(widget, &e);
+ setThemePalette(widget);
+ widget->ensurePolished();
+ }
}
+ if (!m_background)
+ return QPixmap();
return *m_background;
}
-// Generates 1*1 red pixmap as a placeholder for real texture.
+// Generates 1*1 white pixmap as a placeholder for real texture.
// The actual theme texture is drawn in qt_s60_fill_background().
QPixmap QS60StylePrivate::placeHolderTexture()
{
if (!m_placeHolderTexture) {
m_placeHolderTexture = new QPixmap(1,1);
- m_placeHolderTexture->fill(Qt::red);
+ m_placeHolderTexture->fill(Qt::white);
}
return *m_placeHolderTexture;
}