aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickdroparea_p.h
diff options
context:
space:
mode:
authorChris Meyer <cmeyer1969@gmail.com>2013-08-26 16:15:23 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-09 22:58:45 +0200
commit391459210de53e342ba5e9c44360754e86d7625c (patch)
treef68fca8e2f059f8e07b2638245451137af79b479 /src/quick/items/qquickdroparea_p.h
parent2dcb0adc3a0a9b93b4cd09f26f2d1bac0e8cd110 (diff)
Add support for external drag and drop in Quick items.
Add dragType enums with values of None, Automatic, Internal (default). Setting to Automatic allows startDrag to be called automatically. Setting to Internal (default) retains old behavior. Add mimeData to Drag item to enable external drags. Call startDrag to start drag manually or change from internal drag to external drag. Added events dragStarted and dragFinished that get invoked from startDrag. Mime data must be specified in the mimeData property as mime-type / data pairs. Moved QQuickDrag from qquickmousearea* files to qquickdrag* files to reduce header interdependencies that caused linking errors in other modules and also to improve code organization. Allow DropArea to receive and process external data. Introduced new variable containsDrag to QQuickDropAreaPrivate. This replaces mimeData which was previously being used to determine if a drop operation was currently occurring. The problem was that mimeData was being externally destructed. Also introduced accessor methods for getting color, html, image, text, and urls out of the drop. This facilitates dropping of external data of those types onto a DropArea. Added example quick/externaldraganddrop. Task-number: QTBUG-27498 Change-Id: I1420df7c161ea3399e49a23305273e106baa246f Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Diffstat (limited to 'src/quick/items/qquickdroparea_p.h')
-rw-r--r--src/quick/items/qquickdroparea_p.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/quick/items/qquickdroparea_p.h b/src/quick/items/qquickdroparea_p.h
index 3bdbe7f72e..6ba876ef34 100644
--- a/src/quick/items/qquickdroparea_p.h
+++ b/src/quick/items/qquickdroparea_p.h
@@ -62,8 +62,18 @@ class QQuickDropEvent : public QObject
Q_PROPERTY(QObject *source READ source)
Q_PROPERTY(QStringList keys READ keys)
Q_PROPERTY(Qt::DropActions supportedActions READ supportedActions)
+ Q_PROPERTY(Qt::DropActions proposedAction READ proposedAction)
Q_PROPERTY(Qt::DropAction action READ action WRITE setAction RESET resetAction)
Q_PROPERTY(bool accepted READ accepted WRITE setAccepted)
+ Q_PROPERTY(bool hasColor READ hasColor)
+ Q_PROPERTY(bool hasHtml READ hasHtml)
+ Q_PROPERTY(bool hasText READ hasText)
+ Q_PROPERTY(bool hasUrls READ hasUrls)
+ Q_PROPERTY(QVariant colorData READ colorData)
+ Q_PROPERTY(QString html READ html)
+ Q_PROPERTY(QString text READ text)
+ Q_PROPERTY(QList<QUrl> urls READ urls)
+ Q_PROPERTY(QStringList formats READ formats)
public:
QQuickDropEvent(QQuickDropAreaPrivate *d, QDropEvent *event) : d(d), event(event) {}
@@ -73,6 +83,7 @@ public:
QObject *source();
Qt::DropActions supportedActions() const { return event->possibleActions(); }
+ Qt::DropActions proposedAction() const { return event->proposedAction(); }
Qt::DropAction action() const { return event->dropAction(); }
void setAction(Qt::DropAction action) { event->setDropAction(action); }
void resetAction() { event->setDropAction(event->proposedAction()); }
@@ -82,6 +93,18 @@ public:
bool accepted() const { return event->isAccepted(); }
void setAccepted(bool accepted) { event->setAccepted(accepted); }
+ bool hasColor() const;
+ bool hasHtml() const;
+ bool hasText() const;
+ bool hasUrls() const;
+ QVariant colorData() const;
+ QString html() const;
+ QString text() const;
+ QList<QUrl> urls() const;
+ QStringList formats() const;
+
+ Q_INVOKABLE void getDataAsString(QQmlV4Function *);
+ Q_INVOKABLE void acceptProposedAction(QQmlV4Function *);
Q_INVOKABLE void accept(QQmlV4Function *);
private: