diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2020-06-16 10:23:19 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2020-06-16 22:46:16 +0200 |
commit | 1b10ce6a08edbc2ac7e8fd7e97e3fc691f2081df (patch) | |
tree | 34ab485d1dd9435369709b5e77c11af6dec78c22 /src/qml/qml/qqmlimport.cpp | |
parent | b65eee039092fa664e781cdd98a4bb5e66815218 (diff) |
Port QtDeclarative from QStringRef to QStringView
Task-number: QTBUG-84319
Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlimport.cpp')
-rw-r--r-- | src/qml/qml/qqmlimport.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index a5429afd12..ad7cda2145 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -92,7 +92,7 @@ QString resolveLocalUrl(const QString &url, const QString &relative) } else if (relative.at(0) == Slash || !url.contains(Slash)) { return relative; } else { - const QStringRef baseRef = url.leftRef(url.lastIndexOf(Slash) + 1); + const QStringView baseRef = QStringView{url}.left(url.lastIndexOf(Slash) + 1); if (relative == QLatin1String(".")) return baseRef.toString(); @@ -406,7 +406,7 @@ bool excludeBaseUrl(const QString &importUrl, const QString &fileName, const QSt if (baseUrl.startsWith(importUrl)) { - if (fileName == baseUrl.midRef(importUrl.size())) + if (fileName == QStringView{baseUrl}.mid(importUrl.size())) return false; } @@ -1000,17 +1000,17 @@ bool QQmlImportNamespace::resolveType(QQmlTypeLoader *typeLoader, const QHashedS QString u1 = import->url; QString u2 = import2->url; if (base) { - QStringRef b(base); + QStringView b(*base); int dot = b.lastIndexOf(Dot); if (dot >= 0) { b = b.left(dot+1); - QStringRef l = b.left(dot); + QStringView l = b.left(dot); if (u1.startsWith(b)) - u1 = u1.mid(b.count()); + u1 = u1.mid(b.size()); else if (u1 == l) u1 = QQmlImportDatabase::tr("local directory"); if (u2.startsWith(b)) - u2 = u2.mid(b.count()); + u2 = u2.mid(b.size()); else if (u2 == l) u2 = QQmlImportDatabase::tr("local directory"); } @@ -1400,7 +1400,7 @@ QQmlImports::LocalQmldirResult QQmlImportsPrivate::locateLocalQmldir( QString absoluteFilePath = typeLoader.absoluteFilePath(qmldirPath); if (!absoluteFilePath.isEmpty()) { QString url; - const QStringRef absolutePath = absoluteFilePath.leftRef(absoluteFilePath.lastIndexOf(Slash) + 1); + const QStringView absolutePath = QStringView{absoluteFilePath}.left(absoluteFilePath.lastIndexOf(Slash) + 1); if (absolutePath.at(0) == Colon) url = QLatin1String("qrc") + absolutePath; else |