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>
This commit is contained in:
parent
6960fb2f6e
commit
952ea029f4
@ -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;
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user