diff options
| author | Morten Sørvig <morten.sorvig@qt.io> | 2025-11-25 12:20:20 +0100 |
|---|---|---|
| committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2025-12-18 19:34:40 +0000 |
| commit | f6eaa6cca0641a3a6c2207b4b2d479bb177d1b1b (patch) | |
| tree | 6831c1a985bcfd91f074b73c4b24964d6d525160 /doc/src/snippets/code | |
| parent | 08596563298f8bb9e4433f1c0810235bda69ee2f (diff) | |
wasm: support local files access using the native File API
Add support for working with local files using a custom
file engine. Map the local files to prefixed paths like
weblocalfile:/n/filename.ext
where "filename.ext" is the file name provided by the
native API and "n" is a counter to ensure file path
uniqueness (required since the web platform does not
provide the file path)
There are two parts to this support:
1) QWasmFileDialogHelper: a QPlatformFileDialogHelper
subclass which uses the existing QtGui support for native
web file dialogs. On file dialog accept each opened file
is registered with the file engine.
2) QWasmFileEngine: a QAbstractFileEngine subclass which
tracks opened wasm files and maps "webfile" urls to
native file handles (either a File or a FileSystemFileHandle,
depending on browser support).
File read/write is implemented using existing QIODevice
subclasses which support read/write using the native
async API with asyncify/JSPI.
TODO (known issues):
- File handle lifetime management. Currently all file
handles are leaked.
Based on https://codereview.qt-project.org/c/qt/qtbase/+/562724
Pick-to: 6.11
Done-With: Even <even.oscar.andersen@qt.io>
Change-Id: Icf143235fdf2071c34c5be3387d6f7b2b096ff80
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'doc/src/snippets/code')
0 files changed, 0 insertions, 0 deletions
