diff options
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index ee7f779a3a..def3589d9a 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1188,7 +1188,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) if (++QWidgetPrivate::instanceCounter > QWidgetPrivate::maxInstances) QWidgetPrivate::maxInstances = QWidgetPrivate::instanceCounter; - if (QApplicationPrivate::testAttribute(Qt::AA_ImmediateWidgetCreation)) + if (QApplicationPrivate::testAttribute(Qt::AA_ImmediateWidgetCreation)) // ### fixme: Qt 6: Remove AA_ImmediateWidgetCreation. q->create(); QEvent e(QEvent::Create); @@ -4178,7 +4178,7 @@ const QPalette &QWidget::palette() const if (!isEnabled()) { data->pal.setCurrentColorGroup(QPalette::Disabled); } else if ((!isVisible() || isActiveWindow()) -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) && !QApplicationPrivate::isBlockedByModal(const_cast<QWidget *>(this)) #endif ) { @@ -9479,27 +9479,36 @@ void QWidget::updateGeometry() */ void QWidget::setWindowFlags(Qt::WindowFlags flags) { - if (data->window_flags == flags) - return; - Q_D(QWidget); + d->setWindowFlags(flags); +} + +/*! \internal + + Implemented in QWidgetPrivate so that QMdiSubWindowPrivate can reimplement it. +*/ +void QWidgetPrivate::setWindowFlags(Qt::WindowFlags flags) +{ + Q_Q(QWidget); + if (q->data->window_flags == flags) + return; - if ((data->window_flags | flags) & Qt::Window) { + if ((q->data->window_flags | flags) & Qt::Window) { // the old type was a window and/or the new type is a window - QPoint oldPos = pos(); - bool visible = isVisible(); - setParent(parentWidget(), flags); + QPoint oldPos = q->pos(); + bool visible = q->isVisible(); + q->setParent(q->parentWidget(), flags); // if both types are windows or neither of them are, we restore // the old position - if (!((data->window_flags ^ flags) & Qt::Window) - && (visible || testAttribute(Qt::WA_Moved))) { - move(oldPos); + if (!((q->data->window_flags ^ flags) & Qt::Window) + && (visible || q->testAttribute(Qt::WA_Moved))) { + q->move(oldPos); } // for backward-compatibility we change Qt::WA_QuitOnClose attribute value only when the window was recreated. - d->adjustQuitOnCloseAttribute(); + adjustQuitOnCloseAttribute(); } else { - data->window_flags = flags; + q->data->window_flags = flags; } } @@ -9623,6 +9632,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) oldBs->moveStaticWidgets(this); } + // ### fixme: Qt 6: Remove AA_ImmediateWidgetCreation. if (QApplicationPrivate::testAttribute(Qt::AA_ImmediateWidgetCreation) && !testAttribute(Qt::WA_WState_Created)) create(); |