Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

QQmlFile Class

The QQmlFile class provides static utility methods to categorize URLs. More...

Header: #include <QQmlFile>
CMake: find_package(Qt6 REQUIRED COMPONENTS Qml)
target_link_libraries(mytarget PRIVATE Qt6::Qml)
qmake: QT += qml

Static Public Members

bool isLocalFile(const QString &url)
bool isLocalFile(const QUrl &url)
QString urlToLocalFileOrQrc(const QString &url)
QString urlToLocalFileOrQrc(const QUrl &url)

Detailed Description

QQmlFile provides some static utility methods to categorize URLs and file names the way QQmlEngine does when loading content from them.

Member Function Documentation

[static] bool QQmlFile::isLocalFile(const QString &url)

Returns true if url is a local file that can be opened with QFile. Otherwise returns false. Local file urls have either a qrc: or file: scheme.

Note: On Android, urls with assets: or content: scheme are also considered local files.

[static] bool QQmlFile::isLocalFile(const QUrl &url)

Returns true if url is a local file that can be opened with QFile. Otherwise returns false. Local file urls have either a qrc: or file: scheme.

Note: On Android, urls with assets: or content: scheme are also considered local files.

[static] QString QQmlFile::urlToLocalFileOrQrc(const QString &url)

If url is a local file returns a path suitable for passing to QFile. Otherwise returns an empty string.

See also isLocalFile.

[static] QString QQmlFile::urlToLocalFileOrQrc(const QUrl &url)

If url is a local file returns a path suitable for passing to QFile. Otherwise returns an empty string.

See also isLocalFile.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded