From 4fb48f92e7553e8854c943e6117875c2e2b393f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 26 Jul 2010 08:09:04 +0200 Subject: Destroy subwindows in lighthouse --- src/gui/kernel/qwidget_qpa.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 104c529..3584f87 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -116,8 +116,6 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO void QWidget::destroy(bool destroyWindow, bool destroySubWindows) { Q_D(QWidget); - //### jl: subwindows now enabled - Q_UNUSED(destroySubWindows); if ((windowType() == Qt::Popup)) qApp->d_func()->closePopup(this); @@ -127,8 +125,18 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) QApplication::setActiveWindow(0); if (windowType() != Qt::Desktop) { - if (destroyWindow && isWindow()) { -//### jl: delete all child windows... + if (destroySubWindows) { + QObjectList childList(children()); + for (int i = 0; i < childList.size(); i++) { + QWidget *widget = qobject_cast(childList.at(i)); + if (widget && widget->testAttribute(Qt::WA_NativeWindow)) { + if (widget->platformWindow()) { + widget->destroy(); + } + } + } + } + if (destroyWindow) { QTLWExtra *topData = d->maybeTopData(); if (topData) { delete topData->platformWindow; -- cgit v0.12