diff options
author | Sami Merila <sami.merila@nokia.com> | 2011-03-22 08:10:13 (GMT) |
---|---|---|
committer | Sami Merila <sami.merila@nokia.com> | 2011-03-22 08:10:13 (GMT) |
commit | 6733b02876d0f305691e6fc8060502bb3d783c36 (patch) | |
tree | 8b9d9611eee494a01ce513c097310457b0a45109 /src/gui/styles/qs60style.cpp | |
parent | ce61e3c3c6ff7f00d9b756c99e8fc031a69e68db (diff) | |
download | Qt-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.cpp')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index c100330..a9e10a3 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -667,7 +667,7 @@ void QS60StylePrivate::setFont(QWidget *widget) const } } -void QS60StylePrivate::setThemePalette(QWidget *widget) const +void QS60StylePrivate::setThemePalette(QWidget *widget) { if(!widget) return; @@ -752,7 +752,7 @@ void QS60StylePrivate::storeThemePalette(QPalette *palette) } // set widget specific palettes -void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const +void QS60StylePrivate::setThemePaletteHash(QPalette *palette) { if (!palette) return; @@ -3539,8 +3539,14 @@ extern QPoint qt_s60_fill_background_offset(const QWidget *targetWidget); bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush) { + // Check if the widget's palette matches placeholder or actual background texture. + // When accessing backgroundTexture, use parameter value 'true' to avoid creating + // the texture, if it is not already created. + const QPixmap placeHolder(QS60StylePrivate::placeHolderTexture()); - if (placeHolder.cacheKey() != brush.texture().cacheKey()) + const QPixmap bg(QS60StylePrivate::backgroundTexture(true)); + if (placeHolder.cacheKey() != brush.texture().cacheKey() + && bg.cacheKey() != brush.texture().cacheKey()) return false; const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture()); |