diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-04 10:24:46 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-04 10:28:48 +0200 |
commit | 9556f6d075b61fa95d6e1057f305e522a26f71d6 (patch) | |
tree | 53190472453390810c47b9b5a47b23188a00267e /src/quick/items/qquickdroparea.cpp | |
parent | 42ffe9b193a5bd958b0853233fd0d94170722bd1 (diff) | |
parent | 1fd0cdc6a2e01775d8a79c6614910cc5a2fbf2b3 (diff) |
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
src/qml/jsruntime/qv4engine_p.h
src/quick/items/qquickitemsmodule.cpp
src/quick/items/qquicktext.cpp
src/quick/util/qquickpixmapcache.cpp
tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
Change-Id: I90ecaad6a4bfaa4f36149a7463f4d7141f4a516a
Diffstat (limited to 'src/quick/items/qquickdroparea.cpp')
-rw-r--r-- | src/quick/items/qquickdroparea.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp index 217b455d43..e46d546a16 100644 --- a/src/quick/items/qquickdroparea.cpp +++ b/src/quick/items/qquickdroparea.cpp @@ -36,6 +36,7 @@ #include "qquickitem_p.h" #include "qquickwindow.h" +#include <private/qv4arraybuffer_p.h> #include <private/qqmlengine_p.h> #ifndef QT_NO_DRAGANDDROP @@ -496,6 +497,14 @@ void QQuickDropArea::dropEvent(QDropEvent *event) Returns the data for the given \a format converted to a string. \a format should be one contained in the \l formats property. */ +/*! + \qmlmethod string QtQuick::DragEvent::getDataAsArrayBuffer(string format) + \since 5.5 + + Returns the data for the given \a format into an ArrayBuffer, which can + easily be translated into a QByteArray. \a format should be one contained in the \l formats property. +*/ + QObject *QQuickDropEvent::source() { if (const QQuickDragMimeData *dragMime = qobject_cast<const QQuickDragMimeData *>(event->mimeData())) @@ -566,6 +575,17 @@ void QQuickDropEvent::getDataAsString(QQmlV4Function *args) } } +void QQuickDropEvent::getDataAsArrayBuffer(QQmlV4Function *args) +{ + if (args->length() != 0) { + QV4::ExecutionEngine *v4 = args->v4engine(); + QV4::Scope scope(v4); + QV4::ScopedValue v(scope, (*args)[0]); + const QString format = v->toQString(); + args->setReturnValue(v4->newArrayBuffer(event->mimeData()->data(format))->asReturnedValue()); + } +} + void QQuickDropEvent::acceptProposedAction(QQmlV4Function *) { event->acceptProposedAction(); |