aboutsummaryrefslogtreecommitdiff
path: root/src/gui/kconfiggroupgui.cpp
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2021-02-22 22:38:43 +0200
committerAhmad Samir <a.samirh78@gmail.com>2021-03-06 01:33:45 +0200
commitee35bdce8f6b08922b4c9e0c0c838e5f2c4a79ad (patch)
tree591898b2b603d84329fe335675d054ad3e28bbd2 /src/gui/kconfiggroupgui.cpp
parent36f12b207f6a08f6d5fda7d53246a8abe70edf63 (diff)
downloadkconfig-ee35bdce8f6b08922b4c9e0c0c838e5f2c4a79ad.tar.gz
kconfig-ee35bdce8f6b08922b4c9e0c0c838e5f2c4a79ad.tar.bz2
Optimise string operations a bit
- Use QString::arg(Args...) instead of .arg().arg() - Use QLatin1String for string comparisons, should be faster - Use QLatin1String::arg() for better readability - Add the comment dfaure suggested in the MR, to explain why it's '2%' then '%1' in a QString().arg().arg() NO_CHANGELOG
Diffstat (limited to 'src/gui/kconfiggroupgui.cpp')
-rw-r--r--src/gui/kconfiggroupgui.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/kconfiggroupgui.cpp b/src/gui/kconfiggroupgui.cpp
index 09c31590..ab0c268f 100644
--- a/src/gui/kconfiggroupgui.cpp
+++ b/src/gui/kconfiggroupgui.cpp
@@ -54,8 +54,9 @@ static bool readEntryGui(const QByteArray &data, const char *key, const QVariant
const int count = list.count();
if (count != 3 && count != 4) {
- const QString formatError = QStringLiteral(" (wrong format: expected '%1' items, read '%2')");
- qCritical() << qPrintable(errString()) << qPrintable(formatError.arg(QStringLiteral("3' or '4")).arg(count));
+ qCritical() //
+ << qPrintable(errString()) //
+ << qPrintable(QStringLiteral(" (wrong format: expected '%1' items, read '%2')").arg(QStringLiteral("3' or '4")).arg(count));
return true; // return default
}
@@ -70,9 +71,10 @@ static bool readEntryGui(const QByteArray &data, const char *key, const QVariant
}
if (j < 0 || j > 255) {
static const char *const components[] = {"red", "green", "blue", "alpha"};
- const QString boundsError = QStringLiteral(" (bounds error: %1 component %2)");
qCritical() << qPrintable(errString())
- << qPrintable(boundsError.arg(QLatin1String(components[i])).arg(j < 0 ? QStringLiteral("< 0") : QStringLiteral("> 255")));
+ << qPrintable(QStringLiteral(" (bounds error: %1 component %2)")
+ .arg(QLatin1String(components[i]), //
+ j < 0 ? QStringLiteral("< 0") : QStringLiteral("> 255")));
return true; // return default
}
}