Fix rendering glitches when using native widgets in MDI subwindows
When mixing native and regular widgets in same QMdiArea, some subwindows didn't properly get set native. This was because when a native parentless widget was given a parent, it wouldn't enforce native window on the new parent and its ancestors. This happened because window flags were adjusted too late in relation to createWinId() call in setParent_sys(). Fixed by moving the createWinId() call to its proper place. Also removed some old Q_WS_* ifdeffing in QWidget::setParent() that masked some native enforcement code. Additionally removed few QEXPECT_FAILs from QWidget autotest now that those cases work correctly. Task-number: QTBUG-26424 Change-Id: Ib6f9d0531e5c7299e2c307734d49c81f1ffa9713 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
parent
006b620ef9
commit
150284198b
@ -9486,7 +9486,6 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
|
||||
desktopWidget = parent;
|
||||
bool newParent = (parent != parentWidget()) || !wasCreated || desktopWidget;
|
||||
|
||||
#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_MAC)
|
||||
if (newParent && parent && !desktopWidget) {
|
||||
if (testAttribute(Qt::WA_NativeWindow) && !qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)
|
||||
#ifdef Q_WS_MAC
|
||||
@ -9499,7 +9498,6 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
|
||||
else if (parent->d_func()->nativeChildrenForced() || parent->testAttribute(Qt::WA_PaintOnScreen))
|
||||
setAttribute(Qt::WA_NativeWindow);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (wasCreated) {
|
||||
if (!testAttribute(Qt::WA_WState_Hidden)) {
|
||||
|
@ -259,8 +259,6 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
|
||||
if (!(f&Qt::Window) && (oldFlags&Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow)) {
|
||||
//qDebug() << "setParent_sys() change from toplevel";
|
||||
q->destroy();
|
||||
} else if (newparent && wasCreated) {
|
||||
q->createWinId();
|
||||
}
|
||||
|
||||
adjustFlags(f, q);
|
||||
@ -269,6 +267,9 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
|
||||
q->setAttribute(Qt::WA_WState_Visible, false);
|
||||
q->setAttribute(Qt::WA_WState_Hidden, false);
|
||||
|
||||
if (newparent && wasCreated && (q->testAttribute(Qt::WA_NativeWindow) || (f & Qt::Window)))
|
||||
q->createWinId();
|
||||
|
||||
if (q->isWindow() || (!newparent || newparent->isVisible()) || explicitlyHidden)
|
||||
q->setAttribute(Qt::WA_WState_Hidden);
|
||||
q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden);
|
||||
|
@ -7174,14 +7174,8 @@ void tst_QWidget::alienWidgets()
|
||||
|
||||
topLevel.show();
|
||||
QVERIFY(topLevel.internalWinId());
|
||||
if (m_platform == QStringLiteral("xcb") || m_platform == QStringLiteral("windows"))
|
||||
QEXPECT_FAIL("", "QTBUG-26424", Continue);
|
||||
QVERIFY(widget->testAttribute(Qt::WA_NativeWindow));
|
||||
if (m_platform == QStringLiteral("xcb") || m_platform == QStringLiteral("windows"))
|
||||
QEXPECT_FAIL("", "QTBUG-26424", Continue);
|
||||
QVERIFY(child->internalWinId());
|
||||
if (m_platform == QStringLiteral("xcb") || m_platform == QStringLiteral("windows"))
|
||||
QEXPECT_FAIL("", "QTBUG-26424", Continue);
|
||||
QVERIFY(child->testAttribute(Qt::WA_NativeWindow));
|
||||
QVERIFY(!child->testAttribute(Qt::WA_PaintOnScreen));
|
||||
QVERIFY(!dummy->internalWinId());
|
||||
|
Loading…
Reference in New Issue
Block a user