QWebEngineFileSystemAccessRequest Class

The QWebEngineFileSystemAccessRequest class enables accepting or rejecting requests for local file system access from JavaScript applications. More...

Header: #include <QWebEngineFileSystemAccessRequest>
CMake: find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
qmake: QT += webenginecore
Since: Qt 6.4

Public Types

enum AccessFlag { Read, Write }
flags AccessFlags
enum HandleType { File, Directory }

Properties

Public Functions

void accept()
QWebEngineFileSystemAccessRequest::AccessFlags accessFlags() const
QUrl filePath() const
QWebEngineFileSystemAccessRequest::HandleType handleType() const
QUrl origin() const
void reject()
bool operator!=(const QWebEngineFileSystemAccessRequest &lhs, const QWebEngineFileSystemAccessRequest &rhs)
bool operator==(const QWebEngineFileSystemAccessRequest &lhs, const QWebEngineFileSystemAccessRequest &rhs)

Detailed Description

To allow web applications to access local files of the computer, applications must connect to QWebEnginePage::fileSystemAccessRequested, which takes a QWebEngineFileSystemAccessRequest instance as an argument.

If a web applications requests access to local files or directories, QWebEnginePage::fileSystemAccessRequested will be emitted with an QWebEngineFileSystemAccessRequest instance as an argument where accessFlags() indicates the type of the requested access: read, write or both. The signal handler needs to then either call accept() or reject().

Member Type Documentation

enum QWebEngineFileSystemAccessRequest::AccessFlag
flags QWebEngineFileSystemAccessRequest::AccessFlags

This enum describes the type of the requested access: read, write or both. The options can be OR-ed together from the following list:

ConstantValue
QWebEngineFileSystemAccessRequest::Read0x1
QWebEngineFileSystemAccessRequest::Write0x2

The AccessFlags type is a typedef for QFlags<AccessFlag>. It stores an OR combination of AccessFlag values.

enum QWebEngineFileSystemAccessRequest::HandleType

This enum describes the type of the requested file system entry.

ConstantValue
QWebEngineFileSystemAccessRequest::File0
QWebEngineFileSystemAccessRequest::Directory1

Property Documentation

[read-only] accessFlags : const AccessFlags

Contains the requested file access rights.

Access functions:

QWebEngineFileSystemAccessRequest::AccessFlags accessFlags() const

[read-only] filePath : const QUrl

Returns the file path this file system access request is referring to.

Access functions:

QUrl filePath() const

[read-only] handleType : const HandleType

Returns the type of the requested file system entry. (File or directory)

Access functions:

QWebEngineFileSystemAccessRequest::HandleType handleType() const

[read-only] origin : const QUrl

This property holds the URL of the web page that issued the file system access request.

Access functions:

QUrl origin() const

Member Function Documentation

[invokable] void QWebEngineFileSystemAccessRequest::accept()

Accepts the request to access local files.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[invokable] void QWebEngineFileSystemAccessRequest::reject()

Rejects a request to access local files.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

Related Non-Members

[noexcept] bool operator!=(const QWebEngineFileSystemAccessRequest &lhs, const QWebEngineFileSystemAccessRequest &rhs)

Returns true if lhs and rhs point to different requests.

[noexcept] bool operator==(const QWebEngineFileSystemAccessRequest &lhs, const QWebEngineFileSystemAccessRequest &rhs)

Returns true if lhs and rhs both point to the same request.

© 2024 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 the GNU 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.