From bc75a8963ec96fb4131192bf81e60464e6533931 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 31 May 2011 13:38:42 +0200 Subject: [PATCH] Fix for excess creation of QWindow instances. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit topData() is called from various functions for any kind of widgets, not just for top-levels. Therefore createTLSysExtra cannot assume that the widget is top-level. Previously QWindows were created for desktop widget, toolbars, mdi subwindows, etc. which is wrong. The patch will avoid this, and will also fix drawing isses when dragging mdi windows. Reviewed-by: Samuel Rødal --- src/widgets/kernel/qwidget_qpa.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 685965442b..ebd618057c 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -760,7 +760,9 @@ void QWidgetPrivate::createTLSysExtra() { Q_Q(QWidget); extra->topextra->screenIndex = 0; - extra->topextra->window = new QWidgetWindow(q); + extra->topextra->window = 0; + if ((q->testAttribute(Qt::WA_NativeWindow) || q->isWindow()) && q->windowType() != Qt::Desktop) + extra->topextra->window = new QWidgetWindow(q); } void QWidgetPrivate::deleteTLSysExtra()