summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-01-25 12:43:20 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-25 18:00:16 +0100
commit0da4451b783b02d6df464fba9f0c34828df1ac06 (patch)
tree67064bf89372692dc3902b5c880b9c2cd4b6540c
parentb37969bb5d889961a19220a5026c98ce692e4ca7 (diff)
Introduce QGuiApplicationPrivate::windowForWidget.
Change getHWNDForWidget() to take a const QWidget *. Change-Id: I6b0d0bce70487304dfcd4e7a6a039fe8c7ca4aae Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
-rw-r--r--src/widgets/kernel/qapplication_p.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 30d5e4400d..0da36f9262 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -350,11 +350,23 @@ public:
QWidget *native, QWidget **buttonDown, QPointer<QWidget> &lastMouseReceiver,
bool spontaneous = true);
void sendSyntheticEnterLeave(QWidget *widget);
+
+ static QWindow *windowForWidget(const QWidget *widget)
+ {
+ if (QWindow *window = widget->windowHandle())
+ return window;
+ if (const QWidget *nativeParent = widget->nativeParentWidget())
+ return nativeParent->windowHandle();
+ return 0;
+ }
+
#ifdef Q_OS_WIN
- static HWND getHWNDForWidget(QWidget *widget)
+ static HWND getHWNDForWidget(const QWidget *widget)
{
- QWindow *window = widget->windowHandle();
- return static_cast<HWND> (QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window));
+ if (QWindow *window = windowForWidget(widget))
+ return static_cast<HWND> (QGuiApplication::platformNativeInterface()->
+ nativeResourceForWindow(QByteArrayLiteral("handle"), window));
+ return 0;
}
#endif