From 3c329b09fab98087efa6f23905257cba5f665bcd Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 5 Mar 2013 16:26:03 +0100 Subject: Aero-Style-QWizard: Set custom margins only for Areo-Style. Task-number: QTBUG-29904 Change-Id: Ifaf4d5e692f97436535feb1af44dc29d3512c5ea Reviewed-by: Oliver Wolff --- src/widgets/dialogs/qwizard.cpp | 10 ++++------ src/widgets/dialogs/qwizard_win.cpp | 4 ++-- src/widgets/dialogs/qwizard_win_p.h | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index aab6494d98..f7669ba1cc 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -1525,6 +1525,8 @@ void QWizardPrivate::handleAeroStyleChange() vistaHelper->disconnectBackButton(); q->removeEventFilter(vistaHelper); + bool vistaMargins = false; + if (isVistaThemeEnabled()) { if (isVistaThemeEnabled(QVistaHelper::VistaAero)) { vistaHelper->setDWMTitleBar(QVistaHelper::ExtendedTitleBar); @@ -1534,6 +1536,7 @@ void QWizardPrivate::handleAeroStyleChange() vistaHelper->backButton()->move( 0, vistaHelper->topOffset() // ### should ideally work without the '+ 1' - qMin(vistaHelper->topOffset(), vistaHelper->topPadding() + 1)); + vistaMargins = true; } else { vistaHelper->setDWMTitleBar(QVistaHelper::NormalTitleBar); q->setMouseTracking(true); @@ -1556,8 +1559,7 @@ void QWizardPrivate::handleAeroStyleChange() _q_updateButtonStates(); - if (q->isVisible()) - vistaHelper->updateCustomMargins(); + vistaHelper->updateCustomMargins(vistaMargins); inHandleAeroStyleChange = false; } @@ -2922,10 +2924,6 @@ QWidget *QWizard::sideWidget() const void QWizard::setVisible(bool visible) { Q_D(QWizard); -#if !defined(QT_NO_STYLE_WINDOWSVISTA) - if (visible) - d->vistaHelper->updateCustomMargins(); -#endif if (visible) { if (d->current == -1) restart(); diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index ec04fed702..42bdb8369f 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -269,13 +269,13 @@ QVistaHelper::~QVistaHelper() --instanceCount; } -void QVistaHelper::updateCustomMargins() +void QVistaHelper::updateCustomMargins(bool vistaMargins) { if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8) return; // Negative margins are not supported on Windows 8. if (QWindow *window = wizard->windowHandle()) { // Reduce top frame to zero since we paint it ourselves. - const QMargins customMargins = vistaState() == VistaAero ? + const QMargins customMargins = vistaMargins ? QMargins(0, -titleBarSize(), 0, 0) : QMargins(); const QVariant customMarginsV = qVariantFromValue(customMargins); // The dynamic property takes effect when creating the platform window. diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h index 8b370d4e74..a568ef1eff 100644 --- a/src/widgets/dialogs/qwizard_win_p.h +++ b/src/widgets/dialogs/qwizard_win_p.h @@ -87,7 +87,7 @@ public: QVistaHelper(QWizard *wizard); ~QVistaHelper(); enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar }; - void updateCustomMargins(); + void updateCustomMargins(bool vistaMargins); bool setDWMTitleBar(TitleBarChangeType type); void setTitleBarIconAndCaptionVisible(bool visible); void mouseEvent(QEvent *event); -- cgit v1.2.3