summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-03-22 08:59:13 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-03-22 08:59:13 (GMT)
commitbf95c0ed87bf8a2ccd0a3d57ed81b8ae8fb8c4f2 (patch)
treed9f93861d18e84dd4c5e50c3b3ced60a1f6e3528 /src
parent011c6d0f7498bf390e8df1ae646cfb649d8e143f (diff)
parentdfa9643193134612f3e5d25c5fa4f2a9d1fd6837 (diff)
downloadQt-bf95c0ed87bf8a2ccd0a3d57ed81b8ae8fb8c4f2.zip
Qt-bf95c0ed87bf8a2ccd0a3d57ed81b8ae8fb8c4f2.tar.gz
Qt-bf95c0ed87bf8a2ccd0a3d57ed81b8ae8fb8c4f2.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: Fixed drawImage() not to attempt drawing null images on openvg. QS60Style: Update placeholder texture to real one
Diffstat (limited to 'src')
-rw-r--r--src/gui/styles/qs60style.cpp12
-rw-r--r--src/gui/styles/qs60style_p.h6
-rw-r--r--src/gui/styles/qs60style_s60.cpp23
-rw-r--r--src/gui/styles/qs60style_simulated.cpp2
-rw-r--r--src/openvg/qpaintengine_vg.cpp4
5 files changed, 36 insertions, 11 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());
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index 8c023bf..3628b27 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -554,7 +554,7 @@ public:
static QPixmap frame(SkinFrameElements frame, const QSize &size,
SkinElementFlags flags = KDefaultSkinElementFlags);
- static QPixmap backgroundTexture();
+ static QPixmap backgroundTexture(bool skipCreation = false);
static QPixmap placeHolderTexture();
#ifdef Q_WS_S60
@@ -595,9 +595,9 @@ private:
// set S60 font for widget
void setFont(QWidget *widget) const;
- void setThemePalette(QWidget *widget) const;
+ static void setThemePalette(QWidget *widget);
void setThemePalette(QPalette *palette) const;
- void setThemePaletteHash(QPalette *palette) const;
+ static void setThemePaletteHash(QPalette *palette);
static void storeThemePalette(QPalette *palette);
static void deleteThemePalette();
static bool equalToThemePalette(QColor color, QPalette::ColorRole role);
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;
}
diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp
index 77e0d0e..7223c6b 100644
--- a/src/gui/styles/qs60style_simulated.cpp
+++ b/src/gui/styles/qs60style_simulated.cpp
@@ -308,7 +308,7 @@ QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size,
return result;
}
-QPixmap QS60StylePrivate::backgroundTexture()
+QPixmap QS60StylePrivate::backgroundTexture(bool /*skipCreation*/)
{
if (!m_background) {
const QSize size = QApplication::desktop()->screen()->size();
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 3d50558..44dceea 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -3181,6 +3181,8 @@ void QVGPaintEngine::drawImage
Qt::ImageConversionFlags flags)
{
Q_D(QVGPaintEngine);
+ if (image.isNull())
+ return;
VGImage vgImg;
if (d->simpleTransform || d->opacity == 1.0f)
vgImg = toVGImageSubRect(image, sr.toRect(), flags);
@@ -3226,6 +3228,8 @@ void QVGPaintEngine::drawImage
void QVGPaintEngine::drawImage(const QPointF &pos, const QImage &image)
{
Q_D(QVGPaintEngine);
+ if (image.isNull())
+ return;
VGImage vgImg;
if (canVgWritePixels(image)) {
// Optimization for straight blits, no blending