QtGui: port the last remaining Q_FOREACH loops and add QT_NO_FOREACH

Port the last two remaining Q_FOREACH users in QtGui
to C++11 range-for and mark the library as Q_FOREACH
-free, using QT_NO_FOREACH.

Change-Id: Ie6c5eea0af4227af6ef3dc0b4da2cf62e09d8b52
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Marc Mutz 2016-05-11 11:53:02 +02:00
parent f3a4b4258f
commit 8d1fc3ca4d
3 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@ QT = core-private
qtConfig(opengl.*): MODULE_CONFIG = opengl
DEFINES += QT_NO_USING_NAMESPACE
DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
QMAKE_DOCS = $$PWD/doc/qtgui.qdocconf

View File

@ -745,7 +745,7 @@ static void set_text(const QImage &image, png_structp png_ptr, png_infop info_pt
#ifdef PNG_iTXt_SUPPORTED
bool needsItxt = false;
foreach(const QChar c, it.value()) {
for (const QChar c : it.value()) {
uchar ch = c.cell();
if (c.row() || (ch < 0x20 && ch != '\n') || (ch > 0x7e && ch < 0xa0)) {
needsItxt = true;

View File

@ -133,7 +133,7 @@ NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize)
QList<QSize> availableSizes = icon.availableSizes();
if (availableSizes.isEmpty() && defaultSize > 0)
availableSizes << QSize(defaultSize, defaultSize);
foreach (QSize size, availableSizes) {
for (QSize size : qAsConst(availableSizes)) {
QPixmap pm = icon.pixmap(size);
if (pm.isNull())
continue;