diff options
author | Giulio Camuffo <giulio.camuffo@kdab.com> | 2016-04-25 11:11:17 +0300 |
---|---|---|
committer | Giulio Camuffo <giulio.camuffo@kdab.com> | 2016-04-29 13:36:40 +0000 |
commit | 5c5489a26b26ffb77ed53b15857711499424f84d (patch) | |
tree | be37e7c3c985061473046e569d3cf4dcea984c9d /src/compositor/global | |
parent | b85246e7009004d6157d919a6ee4ddb4040ce1e1 (diff) |
Automatically initialize the quick extension objects
Instead of writing "Component.onCompleted: initialize()" for every
extension the compositor has, let them call that automatically.
Change-Id: I0b499a38c2b475dc9a7ef27cbacebef19b196dbf
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
Diffstat (limited to 'src/compositor/global')
-rw-r--r-- | src/compositor/global/qwaylandextension.h | 2 | ||||
-rw-r--r-- | src/compositor/global/qwaylandquickextension.h | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/compositor/global/qwaylandextension.h b/src/compositor/global/qwaylandextension.h index 0088601be..7692aac8f 100644 --- a/src/compositor/global/qwaylandextension.h +++ b/src/compositor/global/qwaylandextension.h @@ -80,7 +80,7 @@ public: QWaylandObject *extensionContainer() const; void setExtensionContainer(QWaylandObject *container); - Q_INVOKABLE virtual void initialize(); + virtual void initialize(); bool isInitialized() const; virtual const struct wl_interface *extensionInterface() const = 0; diff --git a/src/compositor/global/qwaylandquickextension.h b/src/compositor/global/qwaylandquickextension.h index 6322d28fe..64359ffa1 100644 --- a/src/compositor/global/qwaylandquickextension.h +++ b/src/compositor/global/qwaylandquickextension.h @@ -38,11 +38,13 @@ #define QWAYLANDQUICKEXTENSION_H #include <QtWaylandCompositor/QWaylandExtension> +#include <QtQml/QQmlParserStatus> +#include <QtQml/QQmlListProperty> QT_BEGIN_NAMESPACE #define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(className) \ - class Q_WAYLAND_COMPOSITOR_EXPORT className##QuickExtension : public className \ + class Q_WAYLAND_COMPOSITOR_EXPORT className##QuickExtension : public className, public QQmlParserStatus \ { \ /* qmake ignore Q_OBJECT */ \ Q_OBJECT \ @@ -53,6 +55,8 @@ QT_BEGIN_NAMESPACE { \ return QQmlListProperty<QObject>(this, m_objects); \ } \ + void classBegin() Q_DECL_OVERRIDE {} \ + void componentComplete() Q_DECL_OVERRIDE { initialize(); } \ private: \ QList<QObject *> m_objects; \ }; |