2013-07-28 20:11:37 +00:00
|
|
|
#ifndef DROPAREA_H
|
|
|
|
#define DROPAREA_H
|
|
|
|
|
2014-01-15 16:18:02 +00:00
|
|
|
#include <qglobal.h>
|
2016-01-08 19:49:49 +00:00
|
|
|
//#include <QDeclarativeItem>
|
|
|
|
#include <QQuickItem>
|
2013-07-28 20:11:37 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
An oversimplified prototype Item which accepts any drop that includes
|
|
|
|
data with mime type of text/plain, and just emits the text.
|
|
|
|
*/
|
2016-01-08 19:49:49 +00:00
|
|
|
//class DropArea : public QDeclarativeItem
|
|
|
|
class DropArea : public QQuickItem
|
2013-07-28 20:11:37 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(bool acceptingDrops READ isAcceptingDrops WRITE setAcceptingDrops NOTIFY acceptingDropsChanged)
|
|
|
|
|
|
|
|
public:
|
2016-01-08 19:49:49 +00:00
|
|
|
DropArea(QQuickItem *parent=0);
|
2013-07-28 20:11:37 +00:00
|
|
|
bool isAcceptingDrops() const { return m_accepting; }
|
|
|
|
void setAcceptingDrops(bool accepting);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void fileDroped(QString url);
|
|
|
|
void acceptingDropsChanged();
|
|
|
|
|
|
|
|
protected:
|
2016-01-08 19:49:49 +00:00
|
|
|
void dropEvent(QDropEvent * event);
|
|
|
|
// void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
|
|
|
|
// void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
|
|
|
|
// void dropEvent(QGraphicsSceneDragDropEvent *event);
|
2013-07-28 20:11:37 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_accepting;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DROPAREA_H
|