matrixion/src/ui/NhekoDropArea.h

35 lines
795 B
C
Raw Normal View History

2021-03-05 02:35:15 +03:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
2020-11-25 19:02:23 +03:00
#include <QQuickItem>
class NhekoDropArea : public QQuickItem
{
2021-09-18 01:22:33 +03:00
Q_OBJECT
Q_PROPERTY(QString roomid READ roomid WRITE setRoomid NOTIFY roomidChanged)
2020-11-25 19:02:23 +03:00
public:
2021-09-18 01:22:33 +03:00
NhekoDropArea(QQuickItem *parent = nullptr);
2020-11-25 19:02:23 +03:00
signals:
2021-09-18 01:22:33 +03:00
void roomidChanged(QString roomid);
2020-11-25 19:02:23 +03:00
public slots:
2021-09-18 01:22:33 +03:00
void setRoomid(QString roomid)
{
if (roomid_ != roomid) {
roomid_ = roomid;
emit roomidChanged(roomid);
2020-11-25 19:02:23 +03:00
}
2021-09-18 01:22:33 +03:00
}
QString roomid() const { return roomid_; }
2020-11-25 19:02:23 +03:00
protected:
2021-09-18 01:22:33 +03:00
void dragEnterEvent(QDragEnterEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override;
void dropEvent(QDropEvent *event) override;
2020-11-25 19:02:23 +03:00
private:
2021-09-18 01:22:33 +03:00
QString roomid_;
2020-11-25 19:02:23 +03:00
};