Introduce QGuiApplicationPrivate::windowForWidget.

Change getHWNDForWidget() to take a const QWidget *.

Change-Id: I6b0d0bce70487304dfcd4e7a6a039fe8c7ca4aae
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
Friedemann Kleint 2012-01-25 12:43:20 +01:00 committed by Qt by Nokia
parent b37969bb5d
commit 0da4451b78

View File

@ -350,11 +350,23 @@ public:
QWidget *native, QWidget **buttonDown, QPointer<QWidget> &lastMouseReceiver,
bool spontaneous = true);
void sendSyntheticEnterLeave(QWidget *widget);
#ifdef Q_OS_WIN
static HWND getHWNDForWidget(QWidget *widget)
static QWindow *windowForWidget(const QWidget *widget)
{
QWindow *window = widget->windowHandle();
return static_cast<HWND> (QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window));
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(const QWidget *widget)
{
if (QWindow *window = windowForWidget(widget))
return static_cast<HWND> (QGuiApplication::platformNativeInterface()->
nativeResourceForWindow(QByteArrayLiteral("handle"), window));
return 0;
}
#endif