The QQmlFile class provides static utility methods to categorize URLs. 更多...
头: | #include <QQmlFile> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Qml)
target_link_libraries(mytarget PRIVATE Qt6::Qml) |
qmake: | QT += qml |
bool | isLocalFile (const QString & url ) |
bool | isLocalFile (const QUrl & url ) |
QString | urlToLocalFileOrQrc (const QString & url ) |
QString | urlToLocalFileOrQrc (const QUrl & url ) |
QQmlFile provides some static utility methods to categorize URLs and file names the way QQmlEngine does when loading content from them.
[static]
bool
QQmlFile::
isLocalFile
(const
QString
&
url
)
返回
true
if
url
is a local file that can be opened with
QFile
. Otherwise returns
false
. Local file urls have either a
qrc:
or
文件:
方案。
注意:
On Android, urls with
assets:
or
content:
scheme are also considered local files.
[static]
bool
QQmlFile::
isLocalFile
(const
QUrl
&
url
)
返回
true
if
url
is a local file that can be opened with
QFile
. Otherwise returns
false
. Local file urls have either a
qrc:
or
文件:
方案。
注意:
On Android, urls with
assets:
or
content:
scheme are also considered local files.
[static]
QString
QQmlFile::
urlToLocalFileOrQrc
(const
QString
&
url
)
若 url is a local file returns a path suitable for passing to QFile . Otherwise returns an empty string.
另请参阅 isLocalFile .
[static]
QString
QQmlFile::
urlToLocalFileOrQrc
(const
QUrl
&
url
)
若 url is a local file returns a path suitable for passing to QFile . Otherwise returns an empty string.
另请参阅 isLocalFile .