| 1 | // Copyright (C) 2021 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 | |
| 4 | #ifndef INPUTLISTVIEW_H |
| 5 | #define INPUTLISTVIEW_H |
| 6 | |
| 7 | #include <QListWidget> |
| 8 | |
| 9 | class InputListView : public QListWidget |
| 10 | { |
| 11 | public: |
| 12 | InputListView(QWidget *parent = nullptr); |
| 13 | bool tryAddItem(const QString &label); |
| 14 | |
| 15 | protected: |
| 16 | void dropEvent(QDropEvent *ev) override; |
| 17 | void dragEnterEvent(QDragEnterEvent *ev) override; |
| 18 | void dragMoveEvent(QDragMoveEvent *event) override; |
| 19 | void dragLeaveEvent(QDragLeaveEvent *event) override; |
| 20 | |
| 21 | private: |
| 22 | bool containsItem(const QString &needle); |
| 23 | }; |
| 24 | |
| 25 | #endif |
| 26 | |