summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs
diff options
context:
space:
mode:
authorJonathan Liu <net147@gmail.com>2012-09-03 23:52:46 +1000
committerQt by Nokia <qt-info@nokia.com>2012-09-03 16:49:22 +0200
commitd8cc750c58d6e710c821868a2456c2b0a8b0dbbc (patch)
treef1656094a47437dae8238177778be278c36f7eaa /src/gui/dialogs
parent6265ac63fe85e1ff8b2d9ca3d023b3a1a8b281f0 (diff)
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/dialogs')
-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 974290a60b..bd4301a2aa 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 ee424cc194..1db3bbaa1a 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();