A request for letting the user choose a (new or existing) file or directory.More...
Import Statement: | import QtWebEngine 1.10 |
Since: | QtWebEngine 1.4 |
A FileDialogRequest is passed as an argument of theWebEngineView::fileDialogRequested signal. It is generated when the file dialog is requested by the input element. SeeFile Upload state.
Theaccepted property of the request indicates whether the request is handled by the user code or the default dialog should be displayed. If you set theaccepted property totrue
, make sure to call eitherdialogAccept() ordialogReject() afterwards.
The following code uses a custom dialog to handle the request:
WebEngineView {// ... onFileDialogRequested: function(request) { request.accepted=true; myDialog.request= request// keep the reference to the request myDialog.accept.connect(request.dialogAccept); myDialog.reject.connect(request.dialogReject); myDialog.visible=true; }// ...}
accepted :bool |
Indicates whether the file picker dialog request has been handled by the signal handler.
If the property isfalse
after any signal handlers forWebEngineView::fileDialogRequested have been executed, a default file picker dialog will be shown. To prevent this, setrequest.accepted
totrue
.
The default isfalse
.
A list of MIME types specified in the input element. The selection should be restricted to only these types of files.
[read-only]defaultFileName :string |
The default name of the file to be selected in the dialog.
[read-only]mode :enumeration |
The mode of the file dialog.
Constant | Description |
---|---|
FileDialogRequest.FileModeOpen | Allows users to specify a single existing file. |
FileDialogRequest.FileModeOpenMultiple | Allows users to specify multiple existing files. |
FileDialogRequest.FileModeUploadFolder | Allows users to specify a single existing folder for upload. |
FileDialogRequest.FileModeSave | Allows users to specify a non-existing file. If an existing file is selected, the users should be informed that the file is going to be overwritten. |
This function needs to be called when the user accepted the dialog withfiles.
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.
Qt Group includes The Qt Company Oy and its global subsidiaries and affiliates.