diff options
Diffstat (limited to 'plugin/src/Caelestia/serviceref.hpp')
| -rw-r--r-- | plugin/src/Caelestia/serviceref.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/plugin/src/Caelestia/serviceref.hpp b/plugin/src/Caelestia/serviceref.hpp new file mode 100644 index 0000000..fb48a47 --- /dev/null +++ b/plugin/src/Caelestia/serviceref.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include "service.hpp" +#include <QObject> +#include <qqmlintegration.h> + +namespace caelestia { + +class ServiceRef : public QObject { + Q_OBJECT + QML_ELEMENT + + Q_PROPERTY(Service* service READ service WRITE setService NOTIFY serviceChanged) + +public: + explicit ServiceRef(Service* service = nullptr, QObject* parent = nullptr); + ~ServiceRef(); + + [[nodiscard]] Service* service() const; + void setService(Service* service); + +signals: + void serviceChanged(); + +private: + Service* m_service; +}; + +} // namespace caelestia |