From 2b841d40b2647d14aea2a07af4b9ab5a38d43faf Mon Sep 17 00:00:00 2001 From: Mate Barany Date: Fri, 16 Sep 2022 13:48:03 +0200 Subject: QtGui: replace indexed for loop with range for loop This commit addresses a comment from the review of QTBUG-98434. Replace the index based for loop with a range based for loop. Task-number: QTBUG-103100 Change-Id: Iaf92382f07172b254486882beb67f1927ad89be5 Reviewed-by: Sona Kurazyan --- src/gui/kernel/qclipboard.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index e0e2b5d863..6a36862a04 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -243,11 +243,12 @@ QString QClipboard::text(QString &subtype, Mode mode) const if (formats.contains("text/plain"_L1)) subtype = "plain"_L1; else { - for (int i = 0; i < formats.size(); ++i) - if (formats.at(i).startsWith("text/"_L1)) { - subtype = formats.at(i).mid(5); + for (const auto &format : formats) { + if (format.startsWith("text/"_L1)) { + subtype = format.sliced(5); break; } + } if (subtype.isEmpty()) return QString(); } -- cgit v1.2.3