diff options
author | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2009-10-22 14:39:14 (GMT) |
---|---|---|
committer | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2009-10-23 11:25:13 (GMT) |
commit | 3481db791c3b48e28f1a9531b247adf6562edb71 (patch) | |
tree | 201d9160ad1e31bc0986778345b3390474d0f967 /src | |
parent | 19c60da9c15dc609d6d07c687a59d9c2c1a4da13 (diff) | |
download | Qt-3481db791c3b48e28f1a9531b247adf6562edb71.zip Qt-3481db791c3b48e28f1a9531b247adf6562edb71.tar.gz Qt-3481db791c3b48e28f1a9531b247adf6562edb71.tar.bz2 |
Remove internal widgets from QApplication::topLevelWidgets()
We have some internal hidden widgets which should not come up in the
QApplication::topLevelWidgets() list. So the known ones are being
removed from the QWidgetPrivate::allWidgets set.
Task-number: QTBUG-739
Reviewed-by: Denis Dzyubenko
Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qclipboard_win.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qclipboard_x11.cpp | 9 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_win.cpp | 3 | ||||
-rw-r--r-- | src/gui/styles/qwindowsxpstyle.cpp | 5 | ||||
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 5 |
5 files changed, 25 insertions, 1 deletions
diff --git a/src/gui/kernel/qclipboard_win.cpp b/src/gui/kernel/qclipboard_win.cpp index 7f7ef0c..0157052 100644 --- a/src/gui/kernel/qclipboard_win.cpp +++ b/src/gui/kernel/qclipboard_win.cpp @@ -51,6 +51,7 @@ #include "qmime.h" #include "qt_windows.h" #include "qdnd_p.h" +#include <private/qwidget_p.h> QT_BEGIN_NAMESPACE @@ -140,6 +141,9 @@ public: clipBoardViewer = new QWidget(); clipBoardViewer->createWinId(); clipBoardViewer->setObjectName(QLatin1String("internal clipboard owner")); + // We dont need this internal widget to appear in QApplication::topLevelWidgets() + if (QWidgetPrivate::allWidgets) + QWidgetPrivate::allWidgets->remove(clipBoardViewer); } ~QClipboardData() diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp index 9621944..22d7c9e 100644 --- a/src/gui/kernel/qclipboard_x11.cpp +++ b/src/gui/kernel/qclipboard_x11.cpp @@ -78,6 +78,7 @@ #include "qimagewriter.h" #include "qvariant.h" #include "qdnd_p.h" +#include <private/qwidget_p.h> #ifndef QT_NO_XFIXES #include <X11/extensions/Xfixes.h> @@ -131,6 +132,11 @@ void setupOwner() requestor = new QWidget(0); requestor->createWinId(); requestor->setObjectName(QLatin1String("internal clipboard requestor")); + // We dont need this internal widgets to appear in QApplication::topLevelWidgets() + if (QWidgetPrivate::allWidgets) { + QWidgetPrivate::allWidgets->remove(owner); + QWidgetPrivate::allWidgets->remove(requestor); + } qAddPostRoutine(cleanup); } @@ -769,6 +775,9 @@ QByteArray QX11Data::clipboardReadIncrementalProperty(Window win, Atom property, delete requestor; requestor = new QWidget(0); requestor->setObjectName(QLatin1String("internal clipboard requestor")); + // We dont need this internal widget to appear in QApplication::topLevelWidgets() + if (QWidgetPrivate::allWidgets) + QWidgetPrivate::allWidgets->remove(requestor); return QByteArray(); } diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 2b11bec..0672fee 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -161,6 +161,9 @@ static void qt_tablet_init() qt_tablet_widget = new QWidget(0); qt_tablet_widget->createWinId(); qt_tablet_widget->setObjectName(QLatin1String("Qt internal tablet widget")); + // We dont need this internal widget to appear in QApplication::topLevelWidgets() + if (QWidgetPrivate::allWidgets) + QWidgetPrivate::allWidgets->remove(qt_tablet_widget); LOGCONTEXT lcMine; qAddPostRoutine(qt_tablet_cleanup); struct tagAXIS tpOri[3]; diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 9ef30e5..2f00f07 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -47,6 +47,7 @@ #include <private/qpaintengine_raster_p.h> #include <private/qapplication_p.h> #include <private/qstylehelper_p.h> +#include <private/qwidget_p.h> #include <qlibrary.h> #include <qpainter.h> #include <qpaintengine.h> @@ -299,7 +300,11 @@ HWND QWindowsXPStylePrivate::winId(const QWidget *widget) if (!limboWidget) { limboWidget = new QWidget(0); + limboWidget->createWinId(); limboWidget->setObjectName(QLatin1String("xp_limbo_widget")); + // We dont need this internal widget to appear in QApplication::topLevelWidgets() + if (QWidgetPrivate::allWidgets) + QWidgetPrivate::allWidgets->remove(limboWidget); } return limboWidget->winId(); diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 4547416..dcbf021 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -49,12 +49,12 @@ #include <qglpixelbuffer.h> #include <qcolormap.h> #include <qdesktopwidget.h> +#include <private/qwidget_p.h> #include "qdebug.h" #ifdef Q_WS_X11 #include <private/qt_x11_p.h> #include <qx11info_x11.h> -#include <private/qwidget_p.h> #ifndef QT_OPENGL_ES #include <GL/glx.h> @@ -195,6 +195,9 @@ public: if (!initializing && !widget && !cleanedUp) { initializing = true; widget = new QGLWidget; + // We dont need this internal widget to appear in QApplication::topLevelWidgets() + if (QWidgetPrivate::allWidgets) + QWidgetPrivate::allWidgets->remove(widget); initializing = false; } return widget; |