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
qwaylandquickextension.h
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QWAYLANDQUICKEXTENSION_H
6#define QWAYLANDQUICKEXTENSION_H
7
8#if 0
9#pragma qt_class(QWaylandQuickExtension)
10#endif
11
12#include <QtWaylandCompositor/QWaylandCompositorExtension>
13#include <QtQml/QQmlParserStatus>
14#include <QtQml/QQmlListProperty>
15
17
19
20#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(className)
21 class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtension : public className, public QQmlParserStatus
22 { \
23/* qmake ignore Q_OBJECT */
24 Q_OBJECT
25 Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
26 Q_CLASSINFO("DefaultProperty", "data")
27 Q_INTERFACES(QQmlParserStatus)
28 public:
29 QQmlListProperty<QObject> data()
30 {
31 return QQmlListProperty<QObject>(this, &m_objects);
32 }
33 void classBegin() override {}
34 void componentComplete() override { if (!isInitialized()) initialize(); }
35 private:
36 QList<QObject *> m_objects;
37 };
38
39#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CONTAINER_CLASS(className)
40 class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtensionContainer : public className
41 { \
42/* qmake ignore Q_OBJECT */
43 Q_OBJECT
44 Q_PROPERTY(QQmlListProperty<QWaylandCompositorExtension> extensions READ extensions)
45 Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
46 Q_CLASSINFO("DefaultProperty", "data")
47 public:
48 QQmlListProperty<QObject> data()
49 {
50 return QQmlListProperty<QObject>(this, &m_objects);
51 }
52 QQmlListProperty<QWaylandCompositorExtension> extensions()
53 {
54 return QQmlListProperty<QWaylandCompositorExtension>(this, this,
55 &className##QuickExtensionContainer::append_extension,
56 &className##QuickExtensionContainer::countFunction,
57 &className##QuickExtensionContainer::atFunction,
58 &className##QuickExtensionContainer::clearFunction);
59 }
60 static int countFunction(QQmlListProperty<QWaylandCompositorExtension> *list)
61 {
62 return static_cast<className##QuickExtensionContainer *>(list->data)->extension_vector.size();
63 }
64 static QWaylandCompositorExtension *atFunction(QQmlListProperty<QWaylandCompositorExtension> *list, int index)
65 {
66 return static_cast<className##QuickExtensionContainer *>(list->data)->extension_vector.at(index);
67 }
68 static void append_extension(QQmlListProperty<QWaylandCompositorExtension> *list, QWaylandCompositorExtension *extension)
69 {
70 className##QuickExtensionContainer *quickExtObj = static_cast<className##QuickExtensionContainer *>(list->data);
71 extension->setExtensionContainer(quickExtObj);
72 }
73 static void clearFunction(QQmlListProperty<QWaylandCompositorExtension> *list)
74 {
75 static_cast<className##QuickExtensionContainer *>(list->data)->extension_vector.clear();
76 }
77 private:
78 QList<QObject *> m_objects;
79 };
80
81#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(className, QmlType)
83
84#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(...)
85 QT_OVERLOADED_MACRO(Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT, __VA_ARGS__)
86
87#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT_4(className, QmlType, versionMajor,
88 versionMinor)
89 class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtension : public className,
90 public QQmlParserStatus
91 {
92 /* qmake ignore Q_OBJECT */
93 Q_OBJECT
94 Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
95 Q_CLASSINFO("DefaultProperty", "data")
96 Q_INTERFACES(QQmlParserStatus)
97 QML_NAMED_ELEMENT(QmlType)
98 QML_ADDED_IN_VERSION(versionMajor, versionMinor)
99 public:
100 QQmlListProperty<QObject> data()
101 {
102 return QQmlListProperty<QObject>(this, &m_objects);
103 }
104 void classBegin() override { }
105 void componentComplete() override
106 {
107 if (!isInitialized())
108 initialize();
109 }
110
111 private:
112 QList<QObject *> m_objects;
113 };
114
115#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT_2(className, QmlType)
116 class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtension : public className,
117 public QQmlParserStatus
118 {
119 /* qmake ignore Q_OBJECT */
120 Q_OBJECT
121 Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
122 Q_CLASSINFO("DefaultProperty", "data")
123 Q_INTERFACES(QQmlParserStatus)
124 QML_NAMED_ELEMENT(QmlType)
125 public:
126 QQmlListProperty<QObject> data()
127 {
128 return QQmlListProperty<QObject>(this, &m_objects);
129 }
130 void classBegin() override { }
131 void componentComplete() override
132 {
133 if (!isInitialized())
134 initialize();
135 }
136
137 private:
138 QList<QObject *> m_objects;
139 };
140
142
143#endif /*QWAYLANDQUICKEXTENSION_H*/
\inmodule QtSql
#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(...)
QT_REQUIRE_CONFIG(wayland_compositor_quick)