diff options
author | Sami Merila <sami.merila@nokia.com> | 2009-12-23 09:10:24 (GMT) |
---|---|---|
committer | Sami Merila <sami.merila@nokia.com> | 2009-12-23 09:10:24 (GMT) |
commit | 09cd5f7324b8346f1df43a3dff61d337073a6358 (patch) | |
tree | f2181d18555d65aa1e9d5640e9a854305222fba0 /src/gui/styles | |
parent | 6df1c18b63884e4a7ea107fda5b4dbe335e07323 (diff) | |
download | Qt-09cd5f7324b8346f1df43a3dff61d337073a6358.zip Qt-09cd5f7324b8346f1df43a3dff61d337073a6358.tar.gz Qt-09cd5f7324b8346f1df43a3dff61d337073a6358.tar.bz2 |
Device flickers badly when orientation change occurs
Currently what happens when orientation changes is:
1. Application gets notification that status pane size has changed.
2. Qt resizes S60Data to new size, and sends resize event.
3. Application redraws itself. But style is still using incorrect
screen size internally, so background brush is incorrect. Redrawing
thus might showup white rect on-screen.
4. Style gets notification that orientation is changed and style then
deletes existing background brush.
5. Style creates a new background brush and sends events to all toplevel
widgets that style has changed
6. Widgets might draw themselves with new style background brush.
What this fix changes is:
1. When application first tries to redraw itself, style notices that
the background brush size does not match to active screen size.
2. Style immediately re-creates background brush
3. Since cachekey for pixmaps won't match, new background is not drawn
until after background brush has been updated to application palette.
4. Due to #1 style needs to remove deletion of background brush from
clearCaches to avoid deleting (and re-creating) background twice.
Task-number: QTBUG-6428
Reviewed-by: Janne Koskinen
Diffstat (limited to 'src/gui/styles')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 1 | ||||
-rw-r--r-- | src/gui/styles/qs60style_s60.cpp | 17 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index ed86f5a..01b9fa4 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -372,7 +372,6 @@ void QS60StylePrivate::clearCaches(CacheClearReason reason) case CC_LayoutChange: // when layout changes, the colors remain in cache, but graphics and fonts can change m_mappedFontsCache.clear(); - deleteBackground(); QPixmapCache::clear(); break; case CC_ThemeChange: diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 13ac301..fb9665a 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -1133,9 +1133,21 @@ QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size, Skin QPixmap QS60StylePrivate::backgroundTexture() { + bool createNewBackground = false; if (!m_background) { + createNewBackground = true; + } else { + //if background brush does not match screensize, re-create it + if (m_background->width() != S60->screenWidthInPixels || + m_background->height() != S60->screenHeightInPixels) { + delete m_background; + createNewBackground = true; + } + } + + if (createNewBackground) { QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, - QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), 0, SkinElementFlags()); + QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), 0, SkinElementFlags()); m_background = new QPixmap(background); } return *m_background; @@ -1143,8 +1155,7 @@ QPixmap QS60StylePrivate::backgroundTexture() QSize QS60StylePrivate::screenSize() { - const TSize screenSize = QS60Data::screenDevice()->SizeInPixels(); - return QSize(screenSize.iWidth, screenSize.iHeight); + return QSize(S60->screenWidthInPixels, S60->screenHeightInPixels); } QS60Style::QS60Style() |