From dc878289c01011c59615746655b4e78d4bc90b91 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Wed, 3 Feb 2021 15:28:38 +0200 Subject: Minor code optimisations - Use a global var for a QString that's used many times - Break up long-all-cap variable names, it makes it harder to read (and I've fixed one typo in one of those ALLCAPS) - Fix some clazy warnings, make global QString objects in unit tests static (so that the compiler doesn't create symbols for them, it doesn't matter in a unit test but KF code acts as a reference sometimes that others copy from, tip from dfaure) - Add TODO note about changing kconfig_compiler to generate C++ code that uses multi-arg QString::arg(QString, QString, QString) instead of QString::arg().arg() - More const; more QString::at() instead of operator[] where appropriate - Use a ternary where it makes the code more readable (and uses less lines :)) NO_CHANGELOG --- src/gui/kconfigloader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gui/kconfigloader.cpp') diff --git a/src/gui/kconfigloader.cpp b/src/gui/kconfigloader.cpp index 18ec3d9f..538a38ff 100644 --- a/src/gui/kconfigloader.cpp +++ b/src/gui/kconfigloader.cpp @@ -278,7 +278,7 @@ void ConfigLoaderHandler::addItem() */ } else if (m_type == QLatin1String("point")) { QPoint defaultPoint; - QStringList tmpList = m_default.split(QLatin1Char(',')); + const QStringList tmpList = m_default.split(QLatin1Char(',')); if (tmpList.size() >= 2) { defaultPoint.setX(tmpList[0].toInt()); defaultPoint.setY(tmpList[1].toInt()); @@ -286,7 +286,7 @@ void ConfigLoaderHandler::addItem() item = m_config->addItemPoint(m_name, *d->newPoint(), defaultPoint, m_key); } else if (m_type == QLatin1String("rect")) { QRect defaultRect; - QStringList tmpList = m_default.split(QLatin1Char(',')); + const QStringList tmpList = m_default.split(QLatin1Char(',')); if (tmpList.size() >= 4) { defaultRect.setCoords(tmpList[0].toInt(), tmpList[1].toInt(), tmpList[2].toInt(), tmpList[3].toInt()); @@ -294,7 +294,7 @@ void ConfigLoaderHandler::addItem() item = m_config->addItemRect(m_name, *d->newRect(), defaultRect, m_key); } else if (m_type == QLatin1String("size")) { QSize defaultSize; - QStringList tmpList = m_default.split(QLatin1Char(',')); + const QStringList tmpList = m_default.split(QLatin1Char(',')); if (tmpList.size() >= 2) { defaultSize.setWidth(tmpList[0].toInt()); defaultSize.setHeight(tmpList[1].toInt()); -- cgit v1.2.1