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:
parent
b37969bb5d
commit
0da4451b78
@ -350,11 +350,23 @@ public:
|
|||||||
QWidget *native, QWidget **buttonDown, QPointer<QWidget> &lastMouseReceiver,
|
QWidget *native, QWidget **buttonDown, QPointer<QWidget> &lastMouseReceiver,
|
||||||
bool spontaneous = true);
|
bool spontaneous = true);
|
||||||
void sendSyntheticEnterLeave(QWidget *widget);
|
void sendSyntheticEnterLeave(QWidget *widget);
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
static HWND getHWNDForWidget(QWidget *widget)
|
static QWindow *windowForWidget(const QWidget *widget)
|
||||||
{
|
{
|
||||||
QWindow *window = widget->windowHandle();
|
if (QWindow *window = widget->windowHandle())
|
||||||
return static_cast<HWND> (QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window));
|
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
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user