Aero-Style-QWizard: Set custom margins only for Areo-Style.

Task-number: QTBUG-29904

Change-Id: Ifaf4d5e692f97436535feb1af44dc29d3512c5ea
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
This commit is contained in:
Friedemann Kleint 2013-03-05 16:26:03 +01:00 committed by The Qt Project
parent c2530a0f59
commit 3c329b09fa
3 changed files with 7 additions and 9 deletions

View File

@ -1525,6 +1525,8 @@ void QWizardPrivate::handleAeroStyleChange()
vistaHelper->disconnectBackButton(); vistaHelper->disconnectBackButton();
q->removeEventFilter(vistaHelper); q->removeEventFilter(vistaHelper);
bool vistaMargins = false;
if (isVistaThemeEnabled()) { if (isVistaThemeEnabled()) {
if (isVistaThemeEnabled(QVistaHelper::VistaAero)) { if (isVistaThemeEnabled(QVistaHelper::VistaAero)) {
vistaHelper->setDWMTitleBar(QVistaHelper::ExtendedTitleBar); vistaHelper->setDWMTitleBar(QVistaHelper::ExtendedTitleBar);
@ -1534,6 +1536,7 @@ void QWizardPrivate::handleAeroStyleChange()
vistaHelper->backButton()->move( vistaHelper->backButton()->move(
0, vistaHelper->topOffset() // ### should ideally work without the '+ 1' 0, vistaHelper->topOffset() // ### should ideally work without the '+ 1'
- qMin(vistaHelper->topOffset(), vistaHelper->topPadding() + 1)); - qMin(vistaHelper->topOffset(), vistaHelper->topPadding() + 1));
vistaMargins = true;
} else { } else {
vistaHelper->setDWMTitleBar(QVistaHelper::NormalTitleBar); vistaHelper->setDWMTitleBar(QVistaHelper::NormalTitleBar);
q->setMouseTracking(true); q->setMouseTracking(true);
@ -1556,8 +1559,7 @@ void QWizardPrivate::handleAeroStyleChange()
_q_updateButtonStates(); _q_updateButtonStates();
if (q->isVisible()) vistaHelper->updateCustomMargins(vistaMargins);
vistaHelper->updateCustomMargins();
inHandleAeroStyleChange = false; inHandleAeroStyleChange = false;
} }
@ -2922,10 +2924,6 @@ QWidget *QWizard::sideWidget() const
void QWizard::setVisible(bool visible) void QWizard::setVisible(bool visible)
{ {
Q_D(QWizard); Q_D(QWizard);
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
if (visible)
d->vistaHelper->updateCustomMargins();
#endif
if (visible) { if (visible) {
if (d->current == -1) if (d->current == -1)
restart(); restart();

View File

@ -269,13 +269,13 @@ QVistaHelper::~QVistaHelper()
--instanceCount; --instanceCount;
} }
void QVistaHelper::updateCustomMargins() void QVistaHelper::updateCustomMargins(bool vistaMargins)
{ {
if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8) if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8)
return; // Negative margins are not supported on Windows 8. return; // Negative margins are not supported on Windows 8.
if (QWindow *window = wizard->windowHandle()) { if (QWindow *window = wizard->windowHandle()) {
// Reduce top frame to zero since we paint it ourselves. // 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(); QMargins(0, -titleBarSize(), 0, 0) : QMargins();
const QVariant customMarginsV = qVariantFromValue(customMargins); const QVariant customMarginsV = qVariantFromValue(customMargins);
// The dynamic property takes effect when creating the platform window. // The dynamic property takes effect when creating the platform window.

View File

@ -87,7 +87,7 @@ public:
QVistaHelper(QWizard *wizard); QVistaHelper(QWizard *wizard);
~QVistaHelper(); ~QVistaHelper();
enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar }; enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar };
void updateCustomMargins(); void updateCustomMargins(bool vistaMargins);
bool setDWMTitleBar(TitleBarChangeType type); bool setDWMTitleBar(TitleBarChangeType type);
void setTitleBarIconAndCaptionVisible(bool visible); void setTitleBarIconAndCaptionVisible(bool visible);
void mouseEvent(QEvent *event); void mouseEvent(QEvent *event);