aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier De Cannière <olivier.decanniere@qt.io>2024-07-23 16:25:31 +0200
committerOlivier De Cannière <olivier.decanniere@qt.io>2024-08-08 18:39:50 +0200
commitc8943ea7848f0a7cb3b4ee2571eced97f060d80f (patch)
treeda221db414fd76cdfde689b5a4563a8641fb27d5 /src
parent6f9ab2065f4d9d6d4a7c1d6930e6e27cb4cf883e (diff)
QmlCompiler: Pass resource path as QStringView instead of QString
Change-Id: Ia5f5e99fae8a297264a3d3bb84594cb0fc0063c7 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qmlcompiler/qqmljsimportvisitor.cpp4
-rw-r--r--src/qmlcompiler/qqmljsresourcefilemapper.cpp2
-rw-r--r--src/qmlcompiler/qqmljsresourcefilemapper_p.h2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/qmlcompiler/qqmljsimportvisitor.cpp b/src/qmlcompiler/qqmljsimportvisitor.cpp
index e52a1c9a1e..4cf0be0f95 100644
--- a/src/qmlcompiler/qqmljsimportvisitor.cpp
+++ b/src/qmlcompiler/qqmljsimportvisitor.cpp
@@ -2300,10 +2300,10 @@ void QQmlJSImportVisitor::importFromQrc(const QString &path, const QString &pref
{
Q_ASSERT(path.startsWith(u':'));
if (const QQmlJSResourceFileMapper *mapper = m_importer->resourceFileMapper()) {
- const auto pathNoColon = path.mid(1);
+ const auto pathNoColon = QStringView(path).mid(1);
if (mapper->isFile(pathNoColon)) {
const auto entry = m_importer->resourceFileMapper()->entry(
- QQmlJSResourceFileMapper::resourceFileFilter(pathNoColon));
+ QQmlJSResourceFileMapper::resourceFileFilter(pathNoColon.toString()));
const auto scope = m_importer->importFile(entry.filePath);
const QString actualPrefix =
prefix.isEmpty() ? QFileInfo(entry.resourcePath).baseName() : prefix;
diff --git a/src/qmlcompiler/qqmljsresourcefilemapper.cpp b/src/qmlcompiler/qqmljsresourcefilemapper.cpp
index 4213902fb3..5872dedeb3 100644
--- a/src/qmlcompiler/qqmljsresourcefilemapper.cpp
+++ b/src/qmlcompiler/qqmljsresourcefilemapper.cpp
@@ -60,7 +60,7 @@ bool QQmlJSResourceFileMapper::isEmpty() const
return qrcPathToFileSystemPath.isEmpty();
}
-bool QQmlJSResourceFileMapper::isFile(const QString &resourcePath) const
+bool QQmlJSResourceFileMapper::isFile(QStringView resourcePath) const
{
for (const auto &entry : qrcPathToFileSystemPath) {
if (entry.resourcePath == resourcePath)
diff --git a/src/qmlcompiler/qqmljsresourcefilemapper_p.h b/src/qmlcompiler/qqmljsresourcefilemapper_p.h
index 16fb99e82e..d200a92d30 100644
--- a/src/qmlcompiler/qqmljsresourcefilemapper_p.h
+++ b/src/qmlcompiler/qqmljsresourcefilemapper_p.h
@@ -53,7 +53,7 @@ struct Q_QMLCOMPILER_EXPORT QQmlJSResourceFileMapper
QQmlJSResourceFileMapper(const QStringList &resourceFiles);
bool isEmpty() const;
- bool isFile(const QString &resourcePath) const;
+ bool isFile(QStringView resourcePath) const;
QList<Entry> filter(const Filter &filter) const;
QStringList filePaths(const Filter &filter) const;