Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qnativenode.cpp
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <render/qnativenode.h>
5
6#include <EGL/eglplatform.h>
7#include <QtCore/private/qcore_ohos_p.h>
8#include <QtCore/qpointer.h>
9#include <qohosutils.h>
10#include <QtGui/private/qguiapplication_p.h>
11#include <QtGui/private/qohosimageconversions_p.h>
12#include <QtGui/qguiapplication.h>
13#include <ace/xcomponent/native_interface_xcomponent.h>
14#include <arkui/native_node.h>
15#include <arkui/native_type.h>
16#include <arkui/ui_input_event.h>
17#include <native_window/external_window.h>
18#include <qarkui/qembeddedwindownode.h>
19#include <qohosinputmethodeventhandler.h>
20#include <qohosjsmain.h>
21#include <qohosplatformintegration.h>
22#include <qohosplatformwindow.h>
23#include <qohosudmf.h>
24#include <qohosudmfconversions.h>
25#include <qpa/qwindowsysteminterface.h>
26#include <render/qohosarkuinativegestureshandler.h>
27#include <render/qohosdrageventutils.h>
28#include <render/qohosnativeaxiseventhandler.h>
29#include <render/qohosnativedrageventshandler.h>
30#include <render/qohosnativekeyeventshandler.h>
31#include <render/qohosnativemouseeventshandler.h>
32#include <render/qohosnativexcomponentinputhandler.h>
33#include <render/qohosview.h>
34#include <render/qxcomponent.h>
35#include <algorithm>
36#include <cstdint>
37#include <functional>
38#include <iterator>
39
40QT_BEGIN_NAMESPACE
41
42namespace {
43
46
47class CallbackReceiver final : public QArkUi::QXComponentCallbackReceiver
48{
49public:
51 QXComponentRender xComponent,
52 QtOhos::QThreadSafeRef<QWindow> windowRef,
53 QtOhos::QThreadSafeRef<QOhosInputMethodEventHandler> imEventHandlerRef,
54 std::function<void(SurfaceEventType, ::OHNativeWindow *, std::optional<QSize>)> surfaceEventHandler);
55
56 void onSurfaceEvent(SurfaceEventType surfaceEventType, ::OHNativeWindow *nativeWindow) override;
57 void onInputEvent(InputEventType inputEventType, ::OHNativeWindow *window) override;
58 void onHoverEvent(bool isHover) override;
59
60 ~CallbackReceiver() override = default;
61private:
62 std::optional<void *> m_lastWindowArgReceivedViaAnyCallback;
63 std::function<void(SurfaceEventType, ::OHNativeWindow *, std::optional<QSize>)> m_surfaceEventHandler;
64 QSharedPointer<QOhosNativeXComponentInputHandler> m_xComponentInputHandler;
65};
66
67CallbackReceiver::CallbackReceiver(
68 QXComponentRender xComponent,
69 QtOhos::QThreadSafeRef<QWindow> windowRef,
70 QtOhos::QThreadSafeRef<QOhosInputMethodEventHandler> imEventHandlerRef,
71 std::function<void(SurfaceEventType, ::OHNativeWindow *, std::optional<QSize>)> surfaceEventHandler)
77{
78}
79
80void CallbackReceiver::onSurfaceEvent(SurfaceEventType surfaceEventType, ::OHNativeWindow *nativeWindow)
81{
82 m_lastWindowArgReceivedViaAnyCallback = nativeWindow;
83 m_surfaceEventHandler(surfaceEventType, nativeWindow, QOhosSurface::tryGetBufferGeometryForWindow(nativeWindow));
84}
85
86void CallbackReceiver::onInputEvent(InputEventType inputEventType, ::OHNativeWindow *window)
87{
88 m_lastWindowArgReceivedViaAnyCallback = window;
89
90 switch (inputEventType) {
91 case QArkUi::QXComponentCallbackReceiver::InputEventType::Mouse:
92 m_xComponentInputHandler->handleMouseEvent(window);
93 break;
94 case QArkUi::QXComponentCallbackReceiver::InputEventType::Touch:
95 m_xComponentInputHandler->handleTouchEvent(window);
96 break;
97 case QArkUi::QXComponentCallbackReceiver::InputEventType::Keyboard:
98 m_xComponentInputHandler->handleKeyEvent();
99 break;
100 }
101}
102
103void CallbackReceiver::onHoverEvent(bool isHover)
104{
105 if (!m_lastWindowArgReceivedViaAnyCallback.has_value()) {
106 qOhosPrintfWarning("Received hover event before without existing surface");
107 return;
108 }
109
110 m_xComponentInputHandler->handleHoverEvent(m_lastWindowArgReceivedViaAnyCallback.value(), isHover);
111}
112
113}
114
115QNativeNode::QNativeNode(const CreateInfo &nativeNodeCreateInfo)
116 : QObject()
117{
118 auto qWindow = QPointer<QWindow>(nativeNodeCreateInfo.window);
119 auto selfRef = QtOhos::makeQThreadSafeRef(this);
120 auto windowId = QOhosPlatformWindow::fromQWindow(qWindow)->internalWindowId();
121
122 auto platformWindowFlags = QOhosPlatformWindow::platformWindowFlagsForQWindow(qWindow);
123 bool focusable = !platformWindowFlags.testFlag(Qt::WindowDoesNotAcceptFocus);
124
125 auto renderFit = nativeNodeCreateInfo.renderFitPolicyHint.value_or(::ARKUI_RENDER_FIT_TOP_LEFT);
126
127 connect(
128 qGuiApp, &QGuiApplication::focusWindowChanged,
129 this, [this, qWindow](QWindow *focusedWindow) {
130 if (focusedWindow == qWindow)
131 setFocused(true);
132 });
133
134 auto qWindowRef = QtOhos::makeQThreadSafeRef(qWindow.data());
135
136 auto *ohosPlatformIntegration = QOhosPlatformIntegration::instance();
137 auto *inputMethodEventHandler = ohosPlatformIntegration->inputMethodEventHandler();
138 if (inputMethodEventHandler == nullptr)
139 qOhosReportFatalErrorAndAbort("QOhosInputMethodEventHandler is null!");
140 auto imEventHandlerRef = QtOhos::makeQThreadSafeRef(inputMethodEventHandler);
141
142 QOhosJsThreadGateway::runAndWait([&](QOhosJsState &) {
143 using ParentDescriptor = QArkUi::QEmbeddedWindowNode::ParentDescriptor;
144
145 std::optional<ParentDescriptor> optParentDescriptor;
146 if (nativeNodeCreateInfo.optParent.has_value()) {
147 auto *parentNode = nativeNodeCreateInfo.optParent.value()->m_jsStateData->embeddedWindow.get();
148 optParentDescriptor = ParentDescriptor(*parentNode);
149 }
150
151 QArkUi::QQtEmbeddedWindowNode::CreateInfo createInfo = {
152 .offset = nativeNodeCreateInfo.geometry.topLeft(),
153 .size = nativeNodeCreateInfo.geometry.size(),
154 .xComponentId = QXComponentId::createForRenderXComponent(windowId),
155 .xComponentType = ::ArkUI_XComponentType::ARKUI_XCOMPONENT_TYPE_SURFACE,
156 .focusOnTouch = false,
157 .focusable = focusable,
158 .optParent = optParentDescriptor,
159 .sizePolicy = QArkUi::QEmbeddedWindowNode::SizePolicy::Points,
160 .renderFit = renderFit,
161 .backgroundColor = nativeNodeCreateInfo.backgroundColor,
162 };
163
164 m_jsStateData->embeddedWindow = QArkUi::QQtEmbeddedWindowNode::createOrFail(createInfo);
165 m_jsStateData->embeddedWindow->setCallbackReceiver(
166 std::make_unique<CallbackReceiver>(
167 m_jsStateData->embeddedWindow->renderXComponent(),
168 qWindowRef, imEventHandlerRef,
169 [selfRef](SurfaceEventType type, ::OHNativeWindow *window, std::optional<QSize> optSurfaceSize) {
170 selfRef.visitInQtThreadIfAlive(
171 [type, window, optSurfaceSize](auto &self) {
172 self.handleSurfaceEvent(type, window, optSurfaceSize);
173 });
174 }));
175
176 m_jsStateData->embeddedWindow->setTouchInterceptReceiver(
177 [selfRef, embeddedWindow = m_jsStateData->embeddedWindow.get()](const ::ArkUI_UIInputEvent *event) {
178 auto eventAction = ::OH_ArkUI_UIInputEvent_GetAction(event);
179
180 if (eventAction != ::UI_MOUSE_EVENT_ACTION_PRESS && eventAction != ::UI_TOUCH_EVENT_ACTION_DOWN)
181 return;
182
183 if (!embeddedWindow->hasNonQtManagedChildren())
184 return;
185
186 selfRef.visitInQtThreadIfAlive(
187 [](QNativeNode &node) {
188 Q_EMIT node.externalContentClickDetected();
189 });
190 });
191
192 auto sharedAxisEventHandler = QtOhos::moveToSharedPtr(
193 makeQOhosNativeAxisEventHandler(qWindowRef, imEventHandlerRef));
194 m_jsStateData->embeddedWindow->setAxisEventsHandler(
195 [sharedAxisEventHandler](auto *event) {
196 (*sharedAxisEventHandler)(QOhosAxisEventType::AxisEvent, event);
197 }
198 );
199 m_jsStateData->embeddedWindow->setCoastingAxisEventsHandler(
200 [sharedAxisEventHandler](auto *event) {
201 (*sharedAxisEventHandler)(QOhosAxisEventType::CoastingAxisEvent, event);
202 });
203 m_jsStateData->embeddedWindow->setGesturesHandler(
204 makeQOhosArkUiNativeGesturesHandler(qWindowRef));
205 m_jsStateData->embeddedWindow->setDragEventsHandler(makeQOhosNativeDragEventsHandler(qWindowRef));
206 if (QtOhos::isNativeNodeApiKeyEventsEnabled())
207 m_jsStateData->embeddedWindow->setKeyEventsHandler(makeQOhosNativeKeyEventsHandler(qWindowRef, imEventHandlerRef));
208 if (QtOhos::isNativeNodeApiMouseEventsEnabled()) {
209 m_jsStateData->embeddedWindow->setMouseEventsHandler(
210 makeQOhosNativeMouseEventsHandler(qWindowRef, imEventHandlerRef));
211 m_jsStateData->embeddedWindow->setHoverEventsHandler(
212 [qWindowRef, imEventHandlerRef](QArkUi::NativeNodeHoverEvent hoverEvent) {
213 if (hoverEvent.isHovered)
214 return;
215 imEventHandlerRef.visitInQtThreadIfAlive(
216 [qWindowRef](QOhosInputMethodEventHandler &imEventHandler) {
217 QWindow *qWindow = qWindowRef.data();
218 if (qWindow)
219 imEventHandler.onHoverEvent(QOhosHoverEvent { .targetWindow = qWindow });
220 });
221 });
222 }
223 },
224 Q_FUNC_INFO);
225}
226
228{
229 return m_nodeGeometry;
230}
231
232void QNativeNode::setSizeParentFillPercentNormalized(const QSizeF &size, JsCallBatch &jsCallBatch)
233{
234 jsCallBatch.submit(
235 [this, size](QOhosJsState &) {
236 m_jsStateData->embeddedWindow->setSizeParentFillPercentageNormalized(size);
237 },
238 Q_FUNC_INFO);
239}
240
241void QNativeNode::setSize(const QSizeF &size, JsCallBatch &jsCallBatch)
242{
243 m_nodeGeometry.setSize(size.toSize());
244 jsCallBatch.submit(
245 [this, size](QOhosJsState &) {
246 m_jsStateData->embeddedWindow->setSize(size);
247 },
248 Q_FUNC_INFO);
249}
250
251void QNativeNode::setPosition(QPoint position, JsCallBatch &jsCallBatch)
252{
253 m_nodeGeometry.setTopLeft(position);
254 jsCallBatch.submit(
255 [this, position](QOhosJsState &) {
256 m_jsStateData->embeddedWindow->setPosition(position);
257 },
258 Q_FUNC_INFO);
259}
260
261void QNativeNode::setVisibility(bool visible, JsCallBatch &jsCallBatch)
262{
263 jsCallBatch.submit(
264 [this, visible](QOhosJsState &) {
265 m_jsStateData->embeddedWindow->setNodeVisibility(visible);
266 },
267 Q_FUNC_INFO);
268}
269
270QOhosSurface *QNativeNode::surfaceOrNull() const
271{
272 return m_optSurface.get();
273}
274
275void QNativeNode::fillToParent(JsCallBatch &jsCallBatch)
276{
277 jsCallBatch.submit(
278 [this](QOhosJsState &) {
279 m_jsStateData->embeddedWindow->setPosition(QPointF(0, 0));
280 m_jsStateData->embeddedWindow->setSizeParentFillPercentageNormalized(QSizeF(1.0, 1.0));
281 },
282 Q_FUNC_INFO);
283}
284
285void QNativeNode::handleSurfaceEvent(
286 SurfaceEventType surfaceEventType,
287 ::OHNativeWindow *nativeWindow,
288 const std::optional<QSize> &optSurfaceSize)
289{
290 qCDebug(QtForOhos, "Surface event: %d window: %p", surfaceEventType, nativeWindow);
291 switch (surfaceEventType) {
293 {
294 // NOTE - Its possible to receive surface changed event with null nativeWindow
295 if (nativeWindow == nullptr) {
296 m_optSurface.reset();
297 } else if (m_optSurface) {
298 m_optSurface->setNativeWindowSurface(nativeWindow, optSurfaceSize);
299 } else {
300 m_optSurface = std::make_unique<QOhosSurface>(nativeWindow);
301 }
302 break;
303 }
304 case SurfaceEventType::SurfaceCreated:
305 m_optSurface = std::make_unique<QOhosSurface>(nativeWindow);
306 break;
307 case SurfaceEventType::SurfaceDestroyed:
308 m_optSurface.reset();
309 break;
310 }
311 Q_EMIT surfaceStatusChanged(optSurfaceSize);
312}
313
315{
316 return QOhosJsThreadGateway::eval([&](QOhosJsState &) {
317 return reinterpret_cast<WId>(m_jsStateData->embeddedWindow->qtWindowId());
318 },
319 Q_FUNC_INFO);
320}
321
322void QNativeNode::setParent(std::shared_ptr<QXComponentNode> xComponent, JsCallBatch &jsCallBatch)
323{
324 jsCallBatch.submit(
325 [this, xComponent](QOhosJsState &) {
326 m_jsStateData->embeddedWindow->setParentOrReparent(
327 QArkUi::QEmbeddedWindowNode::ParentDescriptor(xComponent));
328 },
329 Q_FUNC_INFO);
330}
331
333{
334 QOhosJsThreadGateway::runAndWait([&](QOhosJsState &){
335 m_jsStateData->embeddedWindow->setParentOrReparent(
336 QArkUi::QEmbeddedWindowNode::ParentDescriptor(*other.m_jsStateData->embeddedWindow));
337 },
338 Q_FUNC_INFO);
339}
340
341void QNativeNode::raise(JsCallBatch &jsCallBatch)
342{
343 jsCallBatch.submit(
344 [this](QOhosJsState &) {
345 auto &window = *m_jsStateData->embeddedWindow;
346 window.raise();
347 },
348 Q_FUNC_INFO);
349}
350
351void QNativeNode::lower(JsCallBatch &jsCallBatch)
352{
353 jsCallBatch.submit(
354 [this](QOhosJsState &) {
355 auto &window = *m_jsStateData->embeddedWindow;
356 window.lower();
357 },
358 Q_FUNC_INFO);
359}
360
361void QNativeNode::detachFromParentIfPresent(JsCallBatch &jsCallBatch)
362{
363 jsCallBatch.submit(
364 [this](QOhosJsState &) {
365 auto &window = *m_jsStateData->embeddedWindow;
366 window.detachFromParentIfPresent();
367 },
368 Q_FUNC_INFO);
369}
370
371void QNativeNode::setFocused(bool focused, JsCallBatch &jsCallBatch)
372{
373 jsCallBatch.submit(
374 [this, focused](QOhosJsState &) {
375 m_jsStateData->embeddedWindow->setFocused(focused);
376 },
377 Q_FUNC_INFO);
378}
379
380void QNativeNode::setFocusable(bool focusable, JsCallBatch &jsCallBatch)
381{
382 jsCallBatch.submit(
383 [this, focusable](QOhosJsState &) {
384 m_jsStateData->embeddedWindow->setFocusable(focusable);
385 },
386 Q_FUNC_INFO);
387}
388
389void QNativeNode::setBackgroundColor(const QColor &color, JsCallBatch &jsCallBatch)
390{
391 jsCallBatch.submit(
392 [this, color](QOhosJsState &) {
393 m_jsStateData->embeddedWindow->setBackgroundColor(color);
394 },
395 Q_FUNC_INFO);
396}
397
398void QNativeNode::setBrightness(int brightness, JsCallBatch &jsCallBatch)
399{
400 jsCallBatch.submit(
401 [this, brightness](QOhosJsState &) {
402 m_jsStateData->embeddedWindow->setBrightness(brightness);
403 },
404 Q_FUNC_INFO);
405}
406
407void QNativeNode::setContrast(int contrast, JsCallBatch &jsCallBatch)
408{
409 jsCallBatch.submit(
410 [this, contrast](QOhosJsState &) {
411 m_jsStateData->embeddedWindow->setContrast(contrast);
412 },
413 Q_FUNC_INFO);
414}
415
416void QNativeNode::setSaturation(int saturation, JsCallBatch &jsCallBatch)
417{
418 jsCallBatch.submit(
419 [this, saturation](QOhosJsState &) {
420 m_jsStateData->embeddedWindow->setSaturation(saturation);
421 },
422 Q_FUNC_INFO);
423}
424
426 const std::vector<QImage> &images, const QPointF &hotspot,
427 const QMimeData &mimeData, QOhosConsumer<Qt::DropAction> dropActionConsumer, JsCallBatch &jsCallBatch)
428{
429 auto udmfDataFactory = makeUdmfDataFactoryFromQMimeData(mimeData, {});
430
431 jsCallBatch.submit(
432 [this, images, hotspot, udmfDataFactory = std::move(udmfDataFactory),
433 dropActionConsumer = std::move(dropActionConsumer)](QOhosJsState &) mutable {
434 qOhosPrintfDebug("%s: starting drag", Q_FUNC_INFO);
435
436 std::vector<std::shared_ptr<::OH_PixelmapNative>> pixelMaps;
437 std::transform(
438 images.begin(), images.end(), std::back_inserter(pixelMaps),
439 &makeOhosNativePixelMapFromQImage);
440
441 struct DragContext
442 {
443 QOhosConsumer<Qt::DropAction> dropActionConsumer;
444 std::shared_ptr<void> startedDragHandle;
445 };
446 auto context = std::make_shared<DragContext>();
447 context->dropActionConsumer = std::move(dropActionConsumer);
448
449 auto startedDragHandle = m_jsStateData->embeddedWindow->startDrag(
450 std::move(pixelMaps), hotspot,
451 udmfDataFactory(),
452 [context](::ArkUI_DragAndDropInfo *dragAndDropInfo) mutable {
453 auto dragStatus = QArkUi::callArkUi(
454 Q_OHOS_NAMED_FUNC(::OH_ArkUI_DragAndDropInfo_GetDragStatus),
455 dragAndDropInfo);
456 qOhosPrintfDebug("%s: drag status: %d", Q_FUNC_INFO, static_cast<int>(dragStatus));
457
458 if (dragStatus == ::ARKUI_DRAG_STATUS_ENDED && context) {
459 auto *dragEvent = QArkUi::callArkUiOrFailOnNullResult(
460 Q_OHOS_NAMED_FUNC(::OH_ArkUI_DragAndDropInfo_GetDragEvent),
461 dragAndDropInfo);
462
463 ::ArkUI_DragResult dragResult = ::ARKUI_DRAG_RESULT_FAILED;
464 QArkUi::callArkUiOrFailOnErrorResult(
465 Q_OHOS_NAMED_FUNC(::OH_ArkUI_DragEvent_GetDragResult),
466 dragEvent, &dragResult);
467
468 auto qtDropAction =
469 dragResult == ::ARKUI_DRAG_RESULT_SUCCESSFUL
470 ? mapQOhosArkUiDropOperationToQt(
471 getQOhosDragEventDropOperation(dragEvent))
472 : Qt::IgnoreAction;
473
474 qOhosPrintfDebug(
475 "%s: sending drag-end notification: %d / %d",
476 Q_FUNC_INFO, static_cast<int>(dragResult), static_cast<int>(qtDropAction));
477 QtOhos::invokeInQtThread(
478 [dropActionConsumer = std::move(context->dropActionConsumer), qtDropAction]() {
479 dropActionConsumer(qtDropAction);
480 });
481 context.reset();
482 }
483 });
484 context->startedDragHandle = startedDragHandle;
485 },
486 Q_FUNC_INFO);
487}
488
489void QNativeNode::enableDropDisallowedBadge(JsCallBatch &jsCallBatch)
490{
491 jsCallBatch.submit(
492 [this](QOhosJsState &) {
493 m_jsStateData->embeddedWindow->enableDropDisallowedBadge();
494 },
495 Q_FUNC_INFO);
496}
497
498void QNativeNode::addForeignWindowChild(QOhosForeignWindow *foreignWindow)
499{
500 QOhosJsThreadGateway::runAndWait([&](QOhosJsState &) {
501 auto &child = foreignWindow->embeddedWindowNodeInJsThread();
502 auto parentDescriptor = QArkUi::QEmbeddedWindowNode::ParentDescriptor(*m_jsStateData->embeddedWindow);
503 child.setParentOrReparent(parentDescriptor);
504 },
505 Q_FUNC_INFO);
506}
507
508void QNativeNode::setTransparentForInput(bool transparentForInput, JsCallBatch &jsCallBatch)
509{
510 jsCallBatch.submit(
511 [this, transparentForInput](QOhosJsState &) {
512 m_jsStateData->embeddedWindow->setHitTestMode(
513 transparentForInput
514 ? ::ARKUI_HIT_TEST_MODE_NONE
515 : ::ARKUI_HIT_TEST_MODE_DEFAULT);
516 },
517 Q_FUNC_INFO);
518}
519
521 QOhosConsumer<QArkUi::QQtEmbeddedWindowNode::NodeAreaInfo> areaChangeEventConsumer, JsCallBatch &jsCallBatch)
522{
523 auto selfRef = QtOhos::makeQThreadSafeRef(this);
524 jsCallBatch.submit(
525 [this, selfRef, areaChangeEventConsumer = std::move(areaChangeEventConsumer)](QOhosJsState &) mutable {
526 m_jsStateData->embeddedWindow->setAreaChangeReceiver(
527 QtOhos::makeCompressingAsyncConsumer(
528 std::move(areaChangeEventConsumer),
529 [selfRef](auto task) {
530 selfRef.visitInQtThreadIfAlive([task = std::move(task)](QNativeNode &) {
531 task();
532 });
533 }));
534 },
535 Q_FUNC_INFO);
536}
537
538void QNativeNode::setNodeFocusChangeHandler(QOhosConsumer<bool> focusedChangedConsumer, JsCallBatch &jsCallBatch)
539{
540 auto selfRef = QtOhos::makeQThreadSafeRef(this);
541 auto sharedConsumer = QtOhos::moveToSharedPtr(std::move(focusedChangedConsumer));
542 jsCallBatch.submit(
543 [this, selfRef, sharedConsumer](QOhosJsState &) {
544 m_jsStateData->embeddedWindow->setFocusedChangeReceiver(
545 [selfRef, sharedConsumer](bool focused) {
546 selfRef.visitInQtThreadIfAlive([focused, sharedConsumer](QNativeNode &) {
547 (*sharedConsumer)(focused);
548 });
549 });
550 },
551 Q_FUNC_INFO);
552}
553
555 QOhosConsumer<bool> visibilityChangedConsumer, JsCallBatch &jsCallBatch)
556{
557 auto selfRef = QtOhos::makeQThreadSafeRef(this);
558 auto sharedConsumer = QtOhos::moveToSharedPtr(std::move(visibilityChangedConsumer));
559 jsCallBatch.submit(
560 [this, selfRef, sharedConsumer](QOhosJsState &) {
561 m_jsStateData->embeddedWindow->setVisibilityChangeReceiver(
562 [selfRef, sharedConsumer](bool visibile) {
563 selfRef.visitInQtThreadIfAlive([visibile, sharedConsumer](QNativeNode &) {
564 (*sharedConsumer)(visibile);
565 });
566 });
567 },
568 Q_FUNC_INFO);
569}
570
572{
573 return QOhosJsThreadGateway::eval(
574 [&](QOhosJsState &) {
575 return m_jsStateData->embeddedWindow->nodeScreenGeometryPixels();
576 },
577 Q_FUNC_INFO);
578}
579
581{
582 return QOhosJsThreadGateway::eval(
583 [&](QOhosJsState &) {
584 return QRect(
585 m_jsStateData->embeddedWindow->parentRelativeOffsetPixels(),
586 m_jsStateData->embeddedWindow->nodeScreenGeometryPixels().size());
587 },
588 Q_FUNC_INFO);
589}
590
591QArkUi::QQtEmbeddedWindowNode::NodeAreaInfo QNativeNode::nodeAreaInfo() const
592{
593 return QOhosJsThreadGateway::eval(
594 [&](QOhosJsState &) {
595 return m_jsStateData->embeddedWindow->nodeAreaInfo();
596 },
597 Q_FUNC_INFO);
598}
599
600QT_END_NAMESPACE
void setPosition(QPoint position, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void setSaturation(int saturation, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void setTransparentForInput(bool transparentForInput, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
QRectF geometry() const
void setNodeVisibilityChangeHandler(QOhosConsumer< bool > visibilityChangedConsumer, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void setSize(const QSizeF &size, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
QRect nodeParentRelativeGeometryPixels() const
void detachFromParentIfPresent(JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void startDrag(const std::vector< QImage > &images, const QPointF &hotspot, const QMimeData &mimeData, QOhosConsumer< Qt::DropAction > dropActionConsumer, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
QOhosSurface * surfaceOrNull() const
void setBackgroundColor(const QColor &color, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
QRect nodeScreenGeometryPixels() const
void lower(JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void fillToParent(JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void setParent(std::shared_ptr< QXComponentNode > xComponent, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void setContrast(int contrast, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void enableDropDisallowedBadge(JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void setNodeAreaChangeHandler(QOhosConsumer< QArkUi::QQtEmbeddedWindowNode::NodeAreaInfo > areaChangeEventConsumer, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void setFocused(bool focused, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
QArkUi::QQtEmbeddedWindowNode::NodeAreaInfo nodeAreaInfo() const
void setVisibility(bool visible, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
QNativeNode(const CreateInfo &nativeNodeCreateInfo)
WId windowId() const
void setFocusable(bool focusable, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void setNodeFocusChangeHandler(QOhosConsumer< bool > focusedChangedConsumer, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void addForeignWindowChild(QOhosForeignWindow *foreignWindow)
void raise(JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void setBrightness(int brightness, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void setSizeParentFillPercentNormalized(const QSizeF &size, JsCallBatch &jsCallBatch=JsCallBatch::immediate())
void setParent(QNativeNode &other)
static QOhosPlatformIntegration * instance()
QOhosInputMethodEventHandler * inputMethodEventHandler() const
void onHoverEvent(bool isHover) override
void onInputEvent(InputEventType inputEventType, ::OHNativeWindow *window) override
void onSurfaceEvent(SurfaceEventType surfaceEventType, ::OHNativeWindow *nativeWindow) override
CallbackReceiver(QXComponentRender xComponent, QtOhos::QThreadSafeRef< QWindow > windowRef, QtOhos::QThreadSafeRef< QOhosInputMethodEventHandler > imEventHandlerRef, std::function< void(SurfaceEventType, ::OHNativeWindow *, std::optional< QSize >)> surfaceEventHandler)
QArkUi::QXComponentCallbackReceiver::InputEventType InputEventType
QArkUi::QXComponentCallbackReceiver::SurfaceEventType SurfaceEventType
QXComponent< QXComponentType::Render > QXComponentRender
Definition qxcomponent.h:43
QXComponent< QXComponentType::Node > QXComponentNode
Definition qxcomponent.h:44