FileDialogRequest QML Type

A request for letting the user choose a (new or existing) file or directory. 更多...

导入语句: import QtWebEngine 1.5
Since: QtWebEngine 1.4

特性

方法

详细描述

A FileDialogRequest is passed as an argument of the WebEngineView::fileDialogRequested signal. It is generated when the file dialog is requested by the input element. See File Upload state .

accepted property of the request indicates whether the request is handled by the user code or the default dialog should be displayed. If you set the accepted 特性到 true , make sure to call either dialogAccept() or dialogReject() 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 is false after any signal handlers for WebEngineView::fileDialogRequested have been executed, a default file picker dialog will be shown. To prevent this, set request.accepted to true .

默认为 false .


[read-only] acceptedMimeTypes : stringlist

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.

常量 描述
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.

方法文档编制

void dialogAccept ( stringlist 文件 )

This function needs to be called when the user accepted the dialog with 文件 .


void dialogReject ()

This function needs to be called when the user did not accepted the dialog.