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 <sona.kurazyan@qt.io>
This commit is contained in:
Mate Barany 2022-09-16 13:48:03 +02:00
parent 33bee95910
commit 2b841d40b2

View File

@ -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();
}