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:
parent
c2530a0f59
commit
3c329b09fa
@ -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();
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user