Commit 7bef8bb2 authored by Volker Krause's avatar Volker Krause
Browse files

Port a few QStringRef occurences to QStringView

Hard to do completely at this point due to the use of QXmlStreamReader.
parent ec68dbf1
......@@ -59,7 +59,7 @@ QString AbstractBackend::preferredLanguage() const
if (m_supportedLanguages.contains(l)) {
return l;
}
if (l.size() > 2 && l[2] == QLatin1Char('-') && m_supportedLanguages.contains(l.leftRef(2))) {
if (l.size() > 2 && l[2] == QLatin1Char('-') && m_supportedLanguages.contains(QStringView(l).left(2))) {
return l.left(2);
}
}
......
......@@ -29,7 +29,7 @@ QString Json::translatedValue(const QJsonObject &obj, const QString &key)
if (it != obj.constEnd()) {
return it.value().toString();
}
const auto language = languageWithCountry.midRef(0, languageWithCountry.indexOf(QLatin1Char('_')));
const auto language = QStringView(languageWithCountry).mid(0, languageWithCountry.indexOf(QLatin1Char('_')));
it = obj.constFind(key + QLatin1Char('[') + language + QLatin1Char(']'));
if (it != obj.constEnd()) {
return it.value().toString();
......
......@@ -127,7 +127,7 @@ Line Line::merge(const Line &lhs, const Line &rhs)
l.setModeString(MergeUtil::mergeString(lhs.modeString(), rhs.modeString()));
l.setName(MergeUtil::mergeString(lhs.name(), rhs.name()));
if (l.name().startsWith(l.modeString(), Qt::CaseInsensitive)) {
l.setName(l.name().midRef(l.modeString().size()).trimmed().toString());
l.setName(QStringView(l.name()).mid(l.modeString().size()).trimmed().toString());
}
l.setColor(mergeColor(lhs.color(), rhs.color()));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment