summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJonathan Liu <net147@gmail.com>2012-09-03 13:52:46 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-09-03 14:49:22 (GMT)
commitd8cc750c58d6e710c821868a2456c2b0a8b0dbbc (patch)
treef1656094a47437dae8238177778be278c36f7eaa /src/gui
parent6265ac63fe85e1ff8b2d9ca3d023b3a1a8b281f0 (diff)
downloadQt-d8cc750c58d6e710c821868a2456c2b0a8b0dbbc.zip
Qt-d8cc750c58d6e710c821868a2456c2b0a8b0dbbc.tar.gz
Qt-d8cc750c58d6e710c821868a2456c2b0a8b0dbbc.tar.bz2
QWizard/Win: Fix incorrect cached state after all wizards destroyed
If a QWizard is shown when Aero is enabled, the current visual style is cached in a static member of QVistaHelper. The cached state is updated by QVistaHelper when it receives WM_THEMECHANGED or WM_DWMCOMPOSITIONCHANGED events from Windows. If all QWizard instances are destroyed, there are no instances of QVistaHelper to receive these notifications and update the cache. If Aero is now disabled, the cached current visual style in QVistaHelper isn't updated. If a wizard is now created and shown, a large black rectangle is shown in the titlebar. A static instance count is added so that when no wizards are running, the cached state is not used. Task-number: QTBUG-27004 Change-Id: Iefe4c8552388280219c9726418ed7476b8ebb15a (cherry picked from commit 952ea029f40aaff9de0101fc165907ef8693e4aa) Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qwizard_win.cpp5
-rw-r--r--src/gui/dialogs/qwizard_win_p.h1
2 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp
index 974290a..bd4301a 100644
--- a/src/gui/dialogs/qwizard_win.cpp
+++ b/src/gui/dialogs/qwizard_win.cpp
@@ -164,6 +164,7 @@ static PtrDrawThemeBackground pDrawThemeBackground = 0;
static PtrGetThemePartSize pGetThemePartSize = 0;
static PtrGetThemeColor pGetThemeColor = 0;
+int QVistaHelper::instanceCount = 0;
bool QVistaHelper::is_vista = false;
QVistaHelper::VistaState QVistaHelper::cachedVistaState = QVistaHelper::Dirty;
@@ -243,6 +244,7 @@ QVistaHelper::QVistaHelper(QWizard *wizard)
, wizard(wizard)
, backButton_(0)
{
+ ++instanceCount;
is_vista = resolveSymbols();
if (is_vista)
backButton_ = new QVistaBackButton(wizard);
@@ -255,6 +257,7 @@ QVistaHelper::QVistaHelper(QWizard *wizard)
QVistaHelper::~QVistaHelper()
{
+ --instanceCount;
}
bool QVistaHelper::isCompositionEnabled()
@@ -277,7 +280,7 @@ bool QVistaHelper::isThemeActive()
QVistaHelper::VistaState QVistaHelper::vistaState()
{
- if (cachedVistaState == Dirty)
+ if (instanceCount == 0 || cachedVistaState == Dirty)
cachedVistaState =
isCompositionEnabled() ? VistaAero : isThemeActive() ? VistaBasic : Classic;
return cachedVistaState;
diff --git a/src/gui/dialogs/qwizard_win_p.h b/src/gui/dialogs/qwizard_win_p.h
index ee424cc..1db3bba 100644
--- a/src/gui/dialogs/qwizard_win_p.h
+++ b/src/gui/dialogs/qwizard_win_p.h
@@ -133,6 +133,7 @@ private:
void mouseReleaseEvent(QMouseEvent *event);
bool eventFilter(QObject *obj, QEvent *event);
+ static int instanceCount;
static bool is_vista;
static VistaState cachedVistaState;
static bool isCompositionEnabled();