summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmdom.h
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2023-12-11 23:48:12 +0100
committerMorten Johan Sørvig <morten.sorvig@qt.io>2023-12-28 02:53:34 +0000
commit0ffe8050bd5b55d64da37f5177a7e20dd9d14232 (patch)
treed4a85c529d36d0515039e15cd92527d320e45603 /src/plugins/platforms/wasm/qwasmdom.h
parent5b7277947cb4ad64f0e784232ace72a9422d692e (diff)
wasm: implement async drag-and-drop
Make toMimeDataWithFile() handle writing files to the in-memory file system correctly: this is an async operation and we need to collect the files as the writes complete and then invoke the callback once all files have been saved. There's then no need for a global static QMimeData. Use toMimeDataWithFile() for both the paste and drop handling, however QPlatformClipboard::setMimeData() takes ownership of the passed in QMimeData and the callback API must be designed accordingly. An open question is when we should delete the files. Deleting them right away (after calling the app event handler) is predictable, however it looks like QPlatformClipboard::setMimeData() retains the current QMimeData until a new one is set, so maybe we should follow that. Pick-to: 6.7 Change-Id: Ia9b825eaef1134ff9a554e51ee7e41d1c2ee779a Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmdom.h')
-rw-r--r--src/plugins/platforms/wasm/qwasmdom.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/plugins/platforms/wasm/qwasmdom.h b/src/plugins/platforms/wasm/qwasmdom.h
index 37c7bc97f1..0a520815a3 100644
--- a/src/plugins/platforms/wasm/qwasmdom.h
+++ b/src/plugins/platforms/wasm/qwasmdom.h
@@ -36,7 +36,7 @@ struct DataTransfer
DataTransfer &operator=(const DataTransfer &other);
DataTransfer &operator=(DataTransfer &&other);
- QMimeData *toMimeDataWithFile(std::function<void(QMimeData &)> callback);
+ void toMimeDataWithFile(std::function<void(QMimeData *)> callback);
QMimeData *toMimeDataPreview();
void setDragImage(emscripten::val element, const QPoint &hotspot);
void setData(std::string format, std::string data);
@@ -44,8 +44,6 @@ struct DataTransfer
void setDataFromMimeData(const QMimeData &mimeData);
emscripten::val webDataTransfer;
- emscripten::val m_webFile = emscripten::val::undefined();
- qstdweb::File m_file;
};
inline emscripten::val document()