From 08c3399568fb90d25b2f71f2ba4c6d791a4fc16c Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Sat, 21 Oct 2023 10:17:58 +0200 Subject: [PATCH] useractions: Simplify for loops --- src/useractions.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/useractions.cpp b/src/useractions.cpp index f1245e8420..b7c17f9bb1 100644 --- a/src/useractions.cpp +++ b/src/useractions.cpp @@ -1793,10 +1793,8 @@ void Window::setShortcut(const QString &_cut) } const QRegularExpression reg(QStringLiteral("(.*\\+)\\((.*)\\)")); QList keys; - QStringList groups = cut.split(QStringLiteral(" - ")); - for (QStringList::ConstIterator it = groups.constBegin(); - it != groups.constEnd(); - ++it) { + const QStringList groups = cut.split(QStringLiteral(" - ")); + for (auto it = groups.begin(); it != groups.end(); ++it) { const QRegularExpressionMatch match = reg.match(*it); if (match.hasMatch()) { const QString base = match.captured(1); @@ -1817,16 +1815,12 @@ void Window::setShortcut(const QString &_cut) } } } - for (auto it = keys.constBegin(); - it != keys.constEnd(); - ++it) { + for (auto it = keys.constBegin(); it != keys.cend(); ++it) { if (_shortcut == *it) { // current one is in the list return; } } - for (auto it = keys.constBegin(); - it != keys.constEnd(); - ++it) { + for (auto it = keys.cbegin(); it != keys.cend(); ++it) { if (workspace()->shortcutAvailable(*it, this)) { updateShortcut(*it); return;