4#ifndef QWAYLANDQUICKEXTENSION_H
5#define QWAYLANDQUICKEXTENSION_H
8#pragma qt_class(QWaylandQuickExtension)
11#include <QtWaylandCompositor/QWaylandCompositorExtension>
12#include <QtQml/QQmlParserStatus>
13#include <QtQml/QQmlListProperty>
19#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(className)
20 class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtension : public className, public QQmlParserStatus
22
24 Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
25 Q_CLASSINFO("DefaultProperty", "data")
26 Q_INTERFACES(QQmlParserStatus)
28 QQmlListProperty<QObject> data()
30 return QQmlListProperty<QObject>(this, &m_objects);
32 void classBegin() override {}
33 void componentComplete() override { if (!isInitialized()) initialize(); }
35 QList<QObject *> m_objects;
38#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CONTAINER_CLASS(className)
39 class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtensionContainer : public className
41
43 Q_PROPERTY(QQmlListProperty<QWaylandCompositorExtension> extensions READ extensions)
44 Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
45 Q_CLASSINFO("DefaultProperty", "data")
47 QQmlListProperty<QObject> data()
49 return QQmlListProperty<QObject>(this, &m_objects);
51 QQmlListProperty<QWaylandCompositorExtension> extensions()
53 return QQmlListProperty<QWaylandCompositorExtension>(this, this,
54 &className##QuickExtensionContainer::append_extension,
55 &className##QuickExtensionContainer::countFunction,
56 &className##QuickExtensionContainer::atFunction,
57 &className##QuickExtensionContainer::clearFunction);
59 static int countFunction(QQmlListProperty<QWaylandCompositorExtension> *list)
61 return static_cast<className##QuickExtensionContainer *>(list->data)->extension_vector.size();
63 static QWaylandCompositorExtension *atFunction(QQmlListProperty<QWaylandCompositorExtension> *list, int index)
65 return static_cast<className##QuickExtensionContainer *>(list->data)->extension_vector.at(index);
67 static void append_extension(QQmlListProperty<QWaylandCompositorExtension> *list, QWaylandCompositorExtension *extension)
69 className##QuickExtensionContainer *quickExtObj = static_cast<className##QuickExtensionContainer *>(list->data);
70 extension->setExtensionContainer(quickExtObj);
72 static void clearFunction(QQmlListProperty<QWaylandCompositorExtension> *list)
74 static_cast<className##QuickExtensionContainer *>(list->data)->extension_vector.clear();
77 QList<QObject *> m_objects;
80#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(className, QmlType)
83#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(...)
86#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT_4(className, QmlType, versionMajor,
88 class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtension : public className,
89 public QQmlParserStatus
93 Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
94 Q_CLASSINFO("DefaultProperty", "data")
95 Q_INTERFACES(QQmlParserStatus)
96 QML_NAMED_ELEMENT(QmlType)
97 QML_ADDED_IN_VERSION(versionMajor, versionMinor)
99 QQmlListProperty<QObject> data()
101 return QQmlListProperty<QObject>(this, &m_objects);
103 void classBegin() override { }
104 void componentComplete() override
106 if (!isInitialized())
111 QList<QObject *> m_objects;
114#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT_2(className, QmlType)
115 class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtension : public className,
116 public QQmlParserStatus
120 Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
121 Q_CLASSINFO("DefaultProperty", "data")
122 Q_INTERFACES(QQmlParserStatus)
123 QML_NAMED_ELEMENT(QmlType)
125 QQmlListProperty<QObject> data()
127 return QQmlListProperty<QObject>(this, &m_objects);
129 void classBegin() override { }
130 void componentComplete() override
132 if (!isInitialized())
137 QList<QObject *> m_objects;
#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(...)
QT_REQUIRE_CONFIG(wayland_compositor_quick)