From b78097b22d11a7279551709b28ef49d403407449 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 23 Dec 2015 00:15:30 +0100 Subject: QtPrintSupport: eradicate all Q_FOREACH loops Saves more than 2KiB in text size on optimized GCC 4.9 Linux AMD64 builds, iow: ~0.5% of the total library size. Change-Id: I84e1dc208da13eefdf1573c9b7ac7c9d76a7f5c7 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/printsupport/kernel/qprinterinfo.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/printsupport/kernel/qprinterinfo.cpp') diff --git a/src/printsupport/kernel/qprinterinfo.cpp b/src/printsupport/kernel/qprinterinfo.cpp index 1be574891b..7ccd7d1fea 100644 --- a/src/printsupport/kernel/qprinterinfo.cpp +++ b/src/printsupport/kernel/qprinterinfo.cpp @@ -318,7 +318,7 @@ QList QPrinterInfo::supportedPaperSizes() const QList list; const QList supportedPageSizes = d->m_printDevice.supportedPageSizes(); list.reserve(supportedPageSizes.size()); - foreach (const QPageSize &pageSize, supportedPageSizes) + for (const QPageSize &pageSize : supportedPageSizes) list.append(QPrinter::PaperSize(pageSize.id())); return list; } @@ -340,7 +340,7 @@ QList > QPrinterInfo::supportedSizesWithNames() const QList > list; const QList supportedPageSizes = d->m_printDevice.supportedPageSizes(); list.reserve(supportedPageSizes.size()); - foreach (const QPageSize &pageSize, supportedPageSizes) + for (const QPageSize &pageSize : supportedPageSizes) list.append(qMakePair(pageSize.name(), pageSize.size(QPageSize::Millimeter))); return list; } @@ -382,7 +382,7 @@ QList QPrinterInfo::supportedDuplexModes() const QList list; const QList supportedDuplexModes = d->m_printDevice.supportedDuplexModes(); list.reserve(supportedDuplexModes.size()); - foreach (QPrint::DuplexMode mode, supportedDuplexModes) + for (QPrint::DuplexMode mode : supportedDuplexModes) list << QPrinter::DuplexMode(mode); return list; } @@ -424,7 +424,7 @@ QList QPrinterInfo::availablePrinters() if (ps) { const QStringList availablePrintDeviceIds = ps->availablePrintDeviceIds(); list.reserve(availablePrintDeviceIds.size()); - foreach (const QString &id, availablePrintDeviceIds) + for (const QString &id : availablePrintDeviceIds) list.append(QPrinterInfo(id)); } return list; -- cgit v1.2.3