diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-11-30 12:19:31 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-12-16 17:41:37 +0000 |
commit | b69751863472b186aaad08db6b9b08de81e95dc4 (patch) | |
tree | 8bea3d79caf491f50770c34f1194a932c62493c1 /src/widgets/dialogs/qfontdialog.cpp | |
parent | 2d3b04e4f613ad3dfec9626bb5840dd91a3b1a82 (diff) |
QtWidgets: replace some Q_FOREACH loops with C++11 range-for
This needs to be handled a bit carefully, because Qt containers
will detach upon being iterated over using range-for.
In the cases of this patch, that cannot happen, because all
containers are marked as const (either by this patch or before).
Separate patches will deal with other situations.
Range-for loops are much more efficient than foreach loops.
This patch shaves almost 3K of text size off an optimized Linux
AMD64 GCC 4.9 build.
Change-Id: I7b1d41db4d9b5db8b515cb75686dc5135177da68
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/widgets/dialogs/qfontdialog.cpp')
-rw-r--r-- | src/widgets/dialogs/qfontdialog.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index 688e8f5c13..659a311d34 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -481,7 +481,8 @@ void QFontDialogPrivate::updateFamilies() QFontDatabase fdb; QStringList familyNames; - foreach (const QString &family, fdb.families(writingSystem)) { + const auto families = fdb.families(writingSystem); + for (const QString &family : families) { if (fdb.isPrivateFamily(family)) continue; |