From dad48f0e9cca10528fcaab7ec7d08f678e81b1a9 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Sat, 23 May 2015 14:10:36 +0200 Subject: Makes it possible to extract all data from a QML DropArea There's many types that aren't being covered by DropArea API, such as images. getDataAsString is not acceptable, since fromUtf8 chokes on reading non-utf8. This patch introduces getDataAsArrayBuffer method that won't try to convert the data into a QString and simply pass a QV4::ArrayBuffer, that internally keeps a QByteArray. Change-Id: I65411b3d365ee6c5e13effd9167156771ee08a05 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4engine.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qml/jsruntime/qv4engine.cpp') diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 5e450859ec..ba6f5a3b79 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -1266,6 +1266,8 @@ static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, int return ld->d()->locale; if (QV4::DateObject *d = value.asDateObject()) return d->toQDateTime(); + if (QV4::ArrayBuffer *d = value.as()) + return d->asByteArray(); // NOTE: since we convert QTime to JS Date, round trip will change the variant type (to QDateTime)! QV4::ScopedObject o(scope, value); -- cgit v1.2.3