summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2012-07-17 16:35:38 +0300
committerQt by Nokia <qt-info@nokia.com>2012-07-18 15:07:32 +0200
commit150284198bae8e200c67087e993ee0c06b5dc901 (patch)
tree92f25a92465517c336130846374c262f69807224 /src
parent006b620ef9390e9396c69db74e31785b04a5d2d6 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/kernel/qwidget.cpp2
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp5
2 files changed, 3 insertions, 4 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index ca5a410a42..747d0a049a 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -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)) {
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index 3661a0802c..5b3155fbc0 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -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);