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
qembeddedwindownode.h
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#ifndef QEMBEDDEDWINDOWNODE_H
5#define QEMBEDDEDWINDOWNODE_H
6
7#include <QtCore/private/qohoscommon_p.h>
8#include <QtCore/qglobal.h>
9#include <QtCore/qrect.h>
10#include <qohosplatformwindowidstruct_hack_p.h>
11#include <arkui/drag_and_drop.h>
12#include <arkui/native_gesture.h>
13#include <arkui/native_node.h>
14#include <arkui/native_type.h>
15#include <arkui/ui_input_event.h>
16#include <cstdint>
17#include <functional>
18#include <memory>
19#include <native_window/external_window.h>
20#include <optional>
21#include <qarkui/input.h>
22#include <qarkui/qnativenodeapi.h>
23#include <qohosplugincore.h>
24#include <qohosudmf.h>
25#include <render/qxcomponent.h>
26#include <vector>
27
29
30namespace QArkUi {
31
42
44{
45public:
47 {
48 public:
55 explicit ParentDescriptor(std::shared_ptr<QXComponentNode> node);
56
59
62
63 Type type() const;
65 std::shared_ptr<QXComponentNode> xComponentNodeOrNull() const;
66 bool operator==(const ParentDescriptor &) const;
67
68 private:
69 Type m_type;
70 std::optional<std::weak_ptr<QEmbeddedWindowNode>> m_embeddedWindowNode;
71 std::optional<std::weak_ptr<QXComponentNode>> m_xComponentNode;
72 };
73
75
76 enum class SizePolicy
77 {
80 };
81
83 std::unique_ptr<Node> stack,
84 std::unique_ptr<Node> contentNode,
85 std::unique_ptr<QtOhos::WindowIdStruct> windowId);
86
89
92
93 void setNodeVisibility(bool visible);
94 void setSize(const QSizeF &size);
95 void setSizeParentFillPercentageNormalized(const QSizeF &size);
96 void setPosition(const QPointF &position);
97 void setFocused(bool focused);
98 void setFocusable(bool focusable);
99 void setBackgroundColor(const QColor &color);
100 void setBrightness(int brightness);
101 void setContrast(int contrast);
102 void setSaturation(int saturation);
103 void setGesturesHandler(QOhosConsumer<const NativeGestureInfo &> gesturesHandler);
104 void setHitTestMode(::ArkUI_HitTestMode hitTestMode);
105 void setDragEventsHandler(QOhosConsumer<::ArkUI_NodeEvent *> dragEventsHandler);
106 void setKeyEventsHandler(QOhosConsumer<::ArkUI_UIInputEvent *> keyEventsHandler);
107 void setHoverEventsHandler(QOhosConsumer<NativeNodeHoverEvent> hoverEventsHandler);
108 void setAxisEventsHandler(QOhosConsumer<::ArkUI_UIInputEvent *> axisEventsHandler);
109 void setMouseEventsHandler(QOhosConsumer<NativeNodeMouseEvent> mouseEventsHandler);
110 void setCoastingAxisEventsHandler(QOhosConsumer<::ArkUI_UIInputEvent *> coastingAxisEventsHandler);
111 std::shared_ptr<void> startDrag(
112 std::vector<std::shared_ptr<::OH_PixelmapNative>> pixelMaps, const QPointF &hotspot,
113 QOhosUdmfData udmfData, std::function<void(::ArkUI_DragAndDropInfo *)> statusListener);
114
115 void raise();
116 void lower();
117
118 void *qtWindowId();
119
122 void handleGestureEvent(const NativeGestureInfo &nativeGestureInfo) const;
123
125
126protected:
127 Node &contentNode();
128 const Node &contentNode() const;
129 Node &stackNode();
130 const Node &stackNode() const;
131
132private:
133 void setContentNodeEventHandler(
134 ::ArkUI_NodeEventType eventType, const char *eventTypeName,
135 QOhosConsumer<::ArkUI_UIInputEvent *> inputEventsHandler);
136
137 std::unique_ptr<Node> m_stackNode;
138 std::unique_ptr<Node> m_contentNode;
139 std::shared_ptr<void> m_nodeEventDispatcherToken;
140 std::optional<ParentDescriptor> m_parentDescriptor;
141 std::unique_ptr<QtOhos::WindowIdStruct> m_windowIdStruct;
142 std::shared_ptr<void> m_nativeNodeDispatcherHandle;
143 QOhosConsumer<const NativeGestureInfo &> m_gesturesHandler;
144};
145
146}
147
148QT_END_NAMESPACE
149
150#endif
ParentDescriptor(ParentDescriptor &&)=default
ParentDescriptor(std::shared_ptr< QXComponentNode > node)
ParentDescriptor & operator=(ParentDescriptor &&)=default
std::shared_ptr< QXComponentNode > xComponentNodeOrNull() const
std::shared_ptr< QEmbeddedWindowNode > embeddedWindowNodeOrNull() const
ParentDescriptor & operator=(const ParentDescriptor &)=default
ParentDescriptor(const ParentDescriptor &)=default
bool operator==(const ParentDescriptor &) const
void setHitTestMode(::ArkUI_HitTestMode hitTestMode)
QEmbeddedWindowNode & operator=(const QEmbeddedWindowNode &)=delete
void setHoverEventsHandler(QOhosConsumer< NativeNodeHoverEvent > hoverEventsHandler)
void setGesturesHandler(QOhosConsumer< const NativeGestureInfo & > gesturesHandler)
void setSizeParentFillPercentageNormalized(const QSizeF &size)
void setAxisEventsHandler(QOhosConsumer<::ArkUI_UIInputEvent * > axisEventsHandler)
void setParentOrReparent(ParentDescriptor parent)
void setKeyEventsHandler(QOhosConsumer<::ArkUI_UIInputEvent * > keyEventsHandler)
QEmbeddedWindowNode(std::unique_ptr< Node > stack, std::unique_ptr< Node > contentNode, std::unique_ptr< QtOhos::WindowIdStruct > windowId)
QEmbeddedWindowNode(const QEmbeddedWindowNode &)=delete
std::shared_ptr< void > startDrag(std::vector< std::shared_ptr<::OH_PixelmapNative > > pixelMaps, const QPointF &hotspot, QOhosUdmfData udmfData, std::function< void(::ArkUI_DragAndDropInfo *)> statusListener)
static const std::int32_t minimumNodeZIndexValue
void setSize(const QSizeF &size)
void setBackgroundColor(const QColor &color)
void handleGestureEvent(const NativeGestureInfo &nativeGestureInfo) const
void setDragEventsHandler(QOhosConsumer<::ArkUI_NodeEvent * > dragEventsHandler)
QEmbeddedWindowNode(QEmbeddedWindowNode &&)=delete
void setPosition(const QPointF &position)
void setCoastingAxisEventsHandler(QOhosConsumer<::ArkUI_UIInputEvent * > coastingAxisEventsHandler)
void setMouseEventsHandler(QOhosConsumer< NativeNodeMouseEvent > mouseEventsHandler)
QEmbeddedWindowNode & operator=(QEmbeddedWindowNode &&)=delete
Combined button and popup list for selecting options.
QXComponent< QXComponentType::Node > QXComponentNode
Definition qxcomponent.h:45
::ArkUI_GestureEvent * event