From c74077a41f5e89c0331d682b481408ad22d7ec78 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 25 Nov 2020 17:02:23 +0100 Subject: Implement Qml drag and drop --- src/ui/NhekoDropArea.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/ui/NhekoDropArea.h (limited to 'src/ui/NhekoDropArea.h') 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 + +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_; +}; -- cgit 1.5.1