5#ifndef QWAYLANDQUICKEXTENSION_H
6#define QWAYLANDQUICKEXTENSION_H
9#pragma qt_class(QWaylandQuickExtension)
12#include <QtWaylandCompositor/QWaylandCompositorExtension>
13#include <QtQml/QQmlParserStatus>
14#include <QtQml/QQmlListProperty>
20#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(className)
21 class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtension : public className, public QQmlParserStatus
23
25 Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
26 Q_CLASSINFO("DefaultProperty", "data")
27 Q_INTERFACES(QQmlParserStatus)
29 QQmlListProperty<QObject> data()
31 return QQmlListProperty<QObject>(this, &m_objects);
33 void classBegin() override {}
34 void componentComplete() override { if (!isInitialized()) initialize(); }
36 QList<QObject *> m_objects;
39#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CONTAINER_CLASS(className)
40 class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtensionContainer : public className
42
44 Q_PROPERTY(QQmlListProperty<QWaylandCompositorExtension> extensions READ extensions)
45 Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
46 Q_CLASSINFO("DefaultProperty", "data")
48 QQmlListProperty<QObject> data()
50 return QQmlListProperty<QObject>(this, &m_objects);
52 QQmlListProperty<QWaylandCompositorExtension> extensions()
54 return QQmlListProperty<QWaylandCompositorExtension>(this, this,
55 &className##QuickExtensionContainer::append_extension,
56 &className##QuickExtensionContainer::countFunction,
57 &className##QuickExtensionContainer::atFunction,
58 &className##QuickExtensionContainer::clearFunction);
60 static int countFunction(QQmlListProperty<QWaylandCompositorExtension> *list)
62 return static_cast<className##QuickExtensionContainer *>(list->data)->extension_vector.size();
64 static QWaylandCompositorExtension *atFunction(QQmlListProperty<QWaylandCompositorExtension> *list, int index)
66 return static_cast<className##QuickExtensionContainer *>(list->data)->extension_vector.at(index);
68 static void append_extension(QQmlListProperty<QWaylandCompositorExtension> *list, QWaylandCompositorExtension *extension)
70 className##QuickExtensionContainer *quickExtObj = static_cast<className##QuickExtensionContainer *>(list->data);
71 extension->setExtensionContainer(quickExtObj);
73 static void clearFunction(QQmlListProperty<QWaylandCompositorExtension> *list)
75 static_cast<className##QuickExtensionContainer *>(list->data)->extension_vector.clear();
78 QList<QObject *> m_objects;
81#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(className, QmlType)
84#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(...)
87#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT_4(className, QmlType, versionMajor,
89 class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtension : public className,
90 public QQmlParserStatus
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)
100 QQmlListProperty<QObject> data()
102 return QQmlListProperty<QObject>(this, &m_objects);
104 void classBegin() override { }
105 void componentComplete() override
107 if (!isInitialized())
112 QList<QObject *> m_objects;
115#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT_2(className, QmlType)
116 class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtension : public className,
117 public QQmlParserStatus
121 Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
122 Q_CLASSINFO("DefaultProperty", "data")
123 Q_INTERFACES(QQmlParserStatus)
124 QML_NAMED_ELEMENT(QmlType)
126 QQmlListProperty<QObject> data()
128 return QQmlListProperty<QObject>(this, &m_objects);
130 void classBegin() override { }
131 void componentComplete() override
133 if (!isInitialized())
138 QList<QObject *> m_objects;
#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(...)
QT_REQUIRE_CONFIG(wayland_compositor_quick)