summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-05-27 11:02:35 +0200
committerLars Knoll <lars.knoll@qt.io>2020-06-15 10:44:04 +0200
commit2393432cd0578d211e78957a4f24f74e7a484114 (patch)
treec337523b5bd42c678841015a37408bbacd38928e
parent31828b3d6b658ef69faaee1f4d2a06a701967294 (diff)
Port androiddeployqt and uic from QStringRef to QStringView
Task-number: QTBUG-84319 Change-Id: I7f30a4d73dd98ee1977645d7274816cd71307506 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/tools/androiddeployqt/main.cpp9
-rw-r--r--src/tools/uic/cpp/cppwriteincludes.cpp2
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp4
-rw-r--r--src/tools/uic/shared/language.cpp8
-rw-r--r--src/tools/uic/uic.cpp4
5 files changed, 14 insertions, 13 deletions
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp
index e9d69fb6a0..766e717498 100644
--- a/src/tools/androiddeployqt/main.cpp
+++ b/src/tools/androiddeployqt/main.cpp
@@ -983,9 +983,10 @@ bool readInputFile(Options *options)
const QJsonValue deploymentDependencies = jsonObject.value(QLatin1String("deployment-dependencies"));
if (!deploymentDependencies.isUndefined()) {
QString deploymentDependenciesString = deploymentDependencies.toString();
- const auto dependencies = deploymentDependenciesString.splitRef(QLatin1Char(','));
- for (const QStringRef &dependency : dependencies) {
- QString path = options->qtInstallDirectory + QLatin1Char('/') + dependency;
+ const auto dependencies = QStringView{deploymentDependenciesString}.split(QLatin1Char(','));
+ for (const auto &dependency : dependencies) {
+ QString path = options->qtInstallDirectory + QChar::fromLatin1('/');
+ path += dependency;
if (QFileInfo(path).isDir()) {
QDirIterator iterator(path, QDirIterator::Subdirectories);
while (iterator.hasNext()) {
@@ -1137,7 +1138,7 @@ bool copyAndroidExtraLibs(Options *options)
return true;
if (options->verbose)
- fprintf(stdout, "Copying %zd external libraries to package.\n", options->extraLibs.size());
+ fprintf(stdout, "Copying %zd external libraries to package.\n", qsizetype(options->extraLibs.size()));
for (const QString &extraLib : options->extraLibs) {
QFileInfo extraLibInfo(extraLib);
diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp
index b9190b8295..9784825c72 100644
--- a/src/tools/uic/cpp/cppwriteincludes.cpp
+++ b/src/tools/uic/cpp/cppwriteincludes.cpp
@@ -315,7 +315,7 @@ void WriteIncludes::writeHeaders(const OrderedSet &headers, bool global)
// Check for the old headers 'qslider.h' and replace by 'QtGui/QSlider'
for (const QString &header : headers) {
const QString value = m_oldHeaderToNewHeader.value(header, header);
- const auto trimmed = QStringRef(&value).trimmed();
+ const auto trimmed = QStringView(value).trimmed();
if (!trimmed.isEmpty())
m_output << "#include " << openingQuote << trimmed << closingQuote << '\n';
}
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index f4899657c9..a0d6bade85 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -1308,7 +1308,7 @@ void WriteInitialization::writeProperties(const QString &varName,
QTextStream str(&setFunction);
if (stdset) {
str << language::derefPointer <<"set" << propertyName.at(0).toUpper()
- << propertyName.midRef(1) << '(';
+ << QStringView{propertyName}.mid(1) << '(';
} else {
str << language::derefPointer << QLatin1String("setProperty(\"")
<< propertyName << "\", ";
@@ -2156,7 +2156,7 @@ void WriteInitialization::addInitializer(Item *item,
if (!value.isEmpty()) {
QString setter;
QTextStream str(&setter);
- str << language::derefPointer << "set" << name.at(0).toUpper() << name.midRef(1) << '(';
+ str << language::derefPointer << "set" << name.at(0).toUpper() << QStringView{name}.mid(1) << '(';
if (column >= 0)
str << column << ", ";
str << value << ");";
diff --git a/src/tools/uic/shared/language.cpp b/src/tools/uic/shared/language.cpp
index a42e7b8461..cbcc7a2b57 100644
--- a/src/tools/uic/shared/language.cpp
+++ b/src/tools/uic/shared/language.cpp
@@ -394,12 +394,12 @@ static void formatMemberFnPtr(QTextStream &str, const SignalSlot &s,
const int parenPos = s.signature.indexOf(QLatin1Char('('));
Q_ASSERT(parenPos >= 0);
if (useQOverload) {
- const auto parameters = s.signature.midRef(parenPos + 1,
+ const auto parameters = QStringView{s.signature}.mid(parenPos + 1,
s.signature.size() - parenPos - 2);
str << "qOverload<" << parameters << ">(";
}
- const auto functionName = s.signature.leftRef(parenPos);
+ const auto functionName = QStringView{s.signature}.left(parenPos);
str << '&' << s.className << "::" << functionName;
if (useQOverload)
@@ -441,9 +441,9 @@ void formatConnection(QTextStream &str, const SignalSlot &sender, const SignalSl
break;
case Language::Python:
str << sender.name << '.'
- << sender.signature.leftRef(sender.signature.indexOf(QLatin1Char('(')))
+ << QStringView{sender.signature}.left(sender.signature.indexOf(QLatin1Char('(')))
<< ".connect(" << receiver.name << '.'
- << receiver.signature.leftRef(receiver.signature.indexOf(QLatin1Char('(')))
+ << QStringView{receiver.signature}.left(receiver.signature.indexOf(QLatin1Char('(')))
<< ')';
break;
}
diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp
index 207356f28d..5b2a602e5f 100644
--- a/src/tools/uic/uic.cpp
+++ b/src/tools/uic/uic.cpp
@@ -130,7 +130,7 @@ static inline bool isCppCommentChar(QChar c)
return c == QLatin1Char('/') || c == QLatin1Char('*');
}
-static int leadingCppCommentCharCount(const QStringRef &s)
+static int leadingCppCommentCharCount(QStringView s)
{
int i = 0;
for (const int size = s.size(); i < size && isCppCommentChar(s.at(i)); ++i) {
@@ -142,7 +142,7 @@ void Uic::writeCopyrightHeaderPython(const DomUI *ui) const
{
QString comment = ui->elementComment();
if (!comment.isEmpty()) {
- const auto lines = comment.splitRef(QLatin1Char('\n'));
+ const auto lines = QStringView{comment}.split(QLatin1Char('\n'));
for (const auto &line : lines) {
if (const int leadingCommentChars = leadingCppCommentCharCount(line)) {
out << language::repeat(leadingCommentChars, '#')