- Qt 6.11
- Qt Qml
- C++ Classes
- QQmlFile
- Qt 6.11.0 Reference Documentation

# 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`

- List of all members, including inherited members
- Deprecated members

## 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.