summary refs log tree commit diff
path: root/src/ui/NhekoDropArea.h
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-11-25 17:02:23 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2020-11-25 19:05:12 +0100
commitc74077a41f5e89c0331d682b481408ad22d7ec78 (patch)
treec867da89f8a4d9d61642f72b645337535b0bbee7 /src/ui/NhekoDropArea.h
parentFix enter when no completion available (diff)
downloadnheko-c74077a41f5e89c0331d682b481408ad22d7ec78.tar.xz
Implement Qml drag and drop
Diffstat (limited to 'src/ui/NhekoDropArea.h')
-rw-r--r--src/ui/NhekoDropArea.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/ui/NhekoDropArea.h b/src/ui/NhekoDropArea.h
new file mode 100644
index 00000000..b03620f2
--- /dev/null
+++ b/src/ui/NhekoDropArea.h
@@ -0,0 +1,30 @@
+#include <QQuickItem>
+
+class NhekoDropArea : public QQuickItem
+{
+        Q_OBJECT
+        Q_PROPERTY(QString roomid READ roomid WRITE setRoomid NOTIFY roomidChanged)
+public:
+        NhekoDropArea(QQuickItem *parent = nullptr);
+
+signals:
+        void roomidChanged(QString roomid);
+
+public slots:
+        void setRoomid(QString roomid)
+        {
+                if (roomid_ != roomid) {
+                        roomid_ = roomid;
+                        emit roomidChanged(roomid);
+                }
+        }
+        QString roomid() const { return roomid_; }
+
+protected:
+        void dragEnterEvent(QDragEnterEvent *event) override;
+        void dragMoveEvent(QDragMoveEvent *event) override;
+        void dropEvent(QDropEvent *event) override;
+
+private:
+        QString roomid_;
+};