このページでは

QQmlFile Class

QQmlFile クラスは、URL を分類するための静的ユーティリティメソッドを提供しています。詳細...

ヘッダー: #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 は、QQmlEngine が URL やファイル名からコンテンツを読み込む際に用いるのと同じ方法で、それらを分類するための静的なユーティリティメソッドをいくつか提供しています。

メンバ関数のドキュメント

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

url がQFile で開くことができるローカルファイルである場合、true を返します。それ以外の場合はfalse を返します。ローカルファイルの URL は、qrc: またはfile: のいずれかのスキームを持ちます。

注:Androidでは 、assets: またはcontent: というスキームを持つURLもローカルファイルとみなされます。

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

url がQFile で開くことができるローカルファイルである場合、true を返します。そうでない場合は、false を返します。ローカルファイルの URL は、qrc: またはfile: のいずれかのスキームを持ちます。

注:Androidでは 、assets: またはcontent: というスキームを持つURLもローカルファイルとみなされます。

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

url がローカルファイルの場合、QFile に渡すのに適したパスを返します。それ以外の場合は、空の文字列を返します。

isLocalFileも参照してください 。

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

url がローカルファイルの場合、QFile に渡すのに適したパスを返します。それ以外の場合は空の文字列を返します。

isLocalFileも参照してください 。

© 2026 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.