summaryrefslogtreecommitdiff
path: root/plugin/src/Caelestia/Internal
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/src/Caelestia/Internal')
-rw-r--r--plugin/src/Caelestia/Internal/hyprdevices.cpp4
-rw-r--r--plugin/src/Caelestia/Internal/hyprdevices.hpp6
-rw-r--r--plugin/src/Caelestia/Internal/hyprextras.hpp2
3 files changed, 7 insertions, 5 deletions
diff --git a/plugin/src/Caelestia/Internal/hyprdevices.cpp b/plugin/src/Caelestia/Internal/hyprdevices.cpp
index 3eba7e4..1ac7d25 100644
--- a/plugin/src/Caelestia/Internal/hyprdevices.cpp
+++ b/plugin/src/Caelestia/Internal/hyprdevices.cpp
@@ -85,8 +85,8 @@ bool HyprKeyboard::updateLastIpcObject(QJsonObject object) {
HyprDevices::HyprDevices(QObject* parent)
: QObject(parent) {}
-QList<HyprKeyboard*> HyprDevices::keyboards() const {
- return m_keyboards;
+QQmlListProperty<HyprKeyboard> HyprDevices::keyboards() {
+ return QQmlListProperty<HyprKeyboard>(this, &m_keyboards);
}
bool HyprDevices::updateLastIpcObject(QJsonObject object) {
diff --git a/plugin/src/Caelestia/Internal/hyprdevices.hpp b/plugin/src/Caelestia/Internal/hyprdevices.hpp
index e10df46..da18063 100644
--- a/plugin/src/Caelestia/Internal/hyprdevices.hpp
+++ b/plugin/src/Caelestia/Internal/hyprdevices.hpp
@@ -3,6 +3,7 @@
#include <qjsonobject.h>
#include <qobject.h>
#include <qqmlintegration.h>
+#include <qqmllist.h>
namespace caelestia::internal::hypr {
@@ -53,12 +54,13 @@ class HyprDevices : public QObject {
QML_ELEMENT
QML_UNCREATABLE("HyprDevices instances can only be retrieved from a HyprExtras")
- Q_PROPERTY(QList<HyprKeyboard*> keyboards READ keyboards NOTIFY keyboardsChanged)
+ Q_PROPERTY(
+ QQmlListProperty<caelestia::internal::hypr::HyprKeyboard> keyboards READ keyboards NOTIFY keyboardsChanged)
public:
explicit HyprDevices(QObject* parent = nullptr);
- [[nodiscard]] QList<HyprKeyboard*> keyboards() const;
+ [[nodiscard]] QQmlListProperty<HyprKeyboard> keyboards();
bool updateLastIpcObject(QJsonObject object);
diff --git a/plugin/src/Caelestia/Internal/hyprextras.hpp b/plugin/src/Caelestia/Internal/hyprextras.hpp
index 9f9e1ad..14563c0 100644
--- a/plugin/src/Caelestia/Internal/hyprextras.hpp
+++ b/plugin/src/Caelestia/Internal/hyprextras.hpp
@@ -12,7 +12,7 @@ class HyprExtras : public QObject {
QML_ELEMENT
Q_PROPERTY(QVariantHash options READ options NOTIFY optionsChanged)
- Q_PROPERTY(HyprDevices* devices READ devices CONSTANT)
+ Q_PROPERTY(caelestia::internal::hypr::HyprDevices* devices READ devices CONSTANT)
public:
explicit HyprExtras(QObject* parent = nullptr);