diff options
author | Jonathan Liu <net147@gmail.com> | 2012-09-03 00:11:57 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-03 11:05:49 +0200 |
commit | 952ea029f40aaff9de0101fc165907ef8693e4aa (patch) | |
tree | b1e853a2d8ec2ad14d2d42e66c7371f312d7dde8 /src/widgets/dialogs/qwizard_win.cpp | |
parent | 6960fb2f6e7d338d16ad883a6feea0da448c76c1 (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
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/widgets/dialogs/qwizard_win.cpp')
-rw-r--r-- | src/widgets/dialogs/qwizard_win.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index 4a4f109a82..7f90efa190 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -166,6 +166,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; @@ -247,6 +248,7 @@ QVistaHelper::QVistaHelper(QWizard *wizard) , wizard(wizard) , backButton_(0) { + ++instanceCount; is_vista = resolveSymbols(); if (is_vista) backButton_ = new QVistaBackButton(wizard); @@ -259,6 +261,7 @@ QVistaHelper::QVistaHelper(QWizard *wizard) QVistaHelper::~QVistaHelper() { + --instanceCount; } bool QVistaHelper::isCompositionEnabled() @@ -281,7 +284,7 @@ bool QVistaHelper::isThemeActive() QVistaHelper::VistaState QVistaHelper::vistaState() { - if (cachedVistaState == Dirty) + if (instanceCount == 0 || cachedVistaState == Dirty) cachedVistaState = isCompositionEnabled() ? VistaAero : isThemeActive() ? VistaBasic : Classic; return cachedVistaState; |