summary refs log tree commit diff
path: root/src/ui/NhekoDropArea.h
blob: 46a02da5cf71f135b206f38eb2a4b5a98ffef2fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// SPDX-FileCopyrightText: Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include <QQuickItem>

class NhekoDropArea : public QQuickItem
{
    Q_OBJECT
    QML_ELEMENT
    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_;
};