-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdroparea.h
44 lines (35 loc) · 1.11 KB
/
droparea.h
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
36
37
38
39
40
41
42
43
44
#ifndef DROPAREA_H
#define DROPAREA_H
#include <QQuickItem>
QT_BEGIN_NAMESPACE
class QMimeData;
QT_END_NAMESPACE
class DropArea : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(QStringList urls READ getUrls NOTIFY urlsChanged)
Q_PROPERTY(int count READ getCount NOTIFY urlsChanged)
public:
explicit DropArea(QQuickItem *parent = 0);
Q_INVOKABLE void clear();
Q_INVOKABLE void removeUrl(int index);
signals:
void urlsChanged();
void dropped(const QStringList urlsDropped);
void entered(const bool acceptable = false, const int reason = 0);
void left();
protected:
void dragEnterEvent(QDragEnterEvent *event);
void dragMoveEvent(QDragMoveEvent *event);
void dragLeaveEvent(QDragLeaveEvent *event);
void dropEvent(QDropEvent *event);
bool isValidImages(const QMimeData *mimeData);
bool isNotExceedingLimit(const QMimeData *mimeData);
QStringList getUrls();
QStringList stringifyUrls(QList<QUrl> _urls);
int getCount();
private:
static const int imageMaxLimit = 12;
QList<QUrl> urls;
};
#endif // DROPAREA_H