wasm: use QWasmWindow::fromWindow()
Make it test for null QWindow and handle(), use it instead of C-style casting handle(). Change-Id: I7ffb1ef5d3d3c09c8ae44ec0141e93530a04abe6 Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io> Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
This commit is contained in:
parent
bdc9665494
commit
83b6139149
@ -327,8 +327,8 @@ void QWasmInputContext::updateInputElement()
|
|||||||
m_inputElement.set("value", "");
|
m_inputElement.set("value", "");
|
||||||
|
|
||||||
m_inputElement.call<void>("blur");
|
m_inputElement.call<void>("blur");
|
||||||
if (focusWindow && focusWindow->handle())
|
if (QWasmWindow *wasmwindow = QWasmWindow::fromWindow(focusWindow))
|
||||||
((QWasmWindow *)(focusWindow->handle()))->focus();
|
wasmwindow->focus();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -211,8 +211,10 @@ QSurfaceFormat QWasmWindow::format() const
|
|||||||
return window()->requestedFormat();
|
return window()->requestedFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
QWasmWindow *QWasmWindow::fromWindow(QWindow *window)
|
QWasmWindow *QWasmWindow::fromWindow(const QWindow *window)
|
||||||
{
|
{
|
||||||
|
if (!window ||!window->handle())
|
||||||
|
return nullptr;
|
||||||
return static_cast<QWasmWindow *>(window->handle());
|
return static_cast<QWasmWindow *>(window->handle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
QWasmBackingStore *backingStore, WId nativeHandle);
|
QWasmBackingStore *backingStore, WId nativeHandle);
|
||||||
~QWasmWindow() final;
|
~QWasmWindow() final;
|
||||||
|
|
||||||
static QWasmWindow *fromWindow(QWindow *window);
|
static QWasmWindow *fromWindow(const QWindow *window);
|
||||||
QSurfaceFormat format() const override;
|
QSurfaceFormat format() const override;
|
||||||
|
|
||||||
void registerEventHandlers();
|
void registerEventHandlers();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user