macOS: Replace foreach with ranged for loops
Change-Id: I9d0dbb60e05e4ef85219740465bb941ef8d8eb0f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
9ba09e26d7
commit
c2efc16126
@ -92,6 +92,8 @@ RESOURCES += qcocoaresources.qrc
|
|||||||
|
|
||||||
LIBS += -framework AppKit -framework CoreServices -framework Carbon -framework IOKit -framework QuartzCore -framework CoreVideo -framework Metal -framework IOSurface -lcups
|
LIBS += -framework AppKit -framework CoreServices -framework Carbon -framework IOKit -framework QuartzCore -framework CoreVideo -framework Metal -framework IOSurface -lcups
|
||||||
|
|
||||||
|
DEFINES += QT_NO_FOREACH
|
||||||
|
|
||||||
QT += \
|
QT += \
|
||||||
core-private gui-private \
|
core-private gui-private \
|
||||||
clipboard_support-private theme_support-private \
|
clipboard_support-private theme_support-private \
|
||||||
|
@ -547,7 +547,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
|
|||||||
return nsActions;
|
return nsActions;
|
||||||
|
|
||||||
const QStringList &supportedActionNames = QAccessibleBridgeUtils::effectiveActionNames(iface);
|
const QStringList &supportedActionNames = QAccessibleBridgeUtils::effectiveActionNames(iface);
|
||||||
foreach (const QString &qtAction, supportedActionNames) {
|
for (const QString &qtAction : supportedActionNames) {
|
||||||
NSString *nsAction = QCocoaAccessible::getTranslatedAction(qtAction);
|
NSString *nsAction = QCocoaAccessible::getTranslatedAction(qtAction);
|
||||||
if (nsAction)
|
if (nsAction)
|
||||||
[nsActions addObject : nsAction];
|
[nsActions addObject : nsAction];
|
||||||
|
@ -116,7 +116,7 @@ class QFontEngineFT;
|
|||||||
static QCocoaIntegration::Options parseOptions(const QStringList ¶mList)
|
static QCocoaIntegration::Options parseOptions(const QStringList ¶mList)
|
||||||
{
|
{
|
||||||
QCocoaIntegration::Options options;
|
QCocoaIntegration::Options options;
|
||||||
foreach (const QString ¶m, paramList) {
|
for (const QString ¶m : paramList) {
|
||||||
#ifndef QT_NO_FREETYPE
|
#ifndef QT_NO_FREETYPE
|
||||||
if (param == QLatin1String("fontengine=freetype"))
|
if (param == QLatin1String("fontengine=freetype"))
|
||||||
options |= QCocoaIntegration::UseFreeTypeFontEngine;
|
options |= QCocoaIntegration::UseFreeTypeFontEngine;
|
||||||
|
@ -191,7 +191,7 @@ void QCocoaMenuBar::syncMenu_helper(QPlatformMenu *menu, bool menubarUpdate)
|
|||||||
QMacAutoReleasePool pool;
|
QMacAutoReleasePool pool;
|
||||||
|
|
||||||
QCocoaMenu *cocoaMenu = static_cast<QCocoaMenu *>(menu);
|
QCocoaMenu *cocoaMenu = static_cast<QCocoaMenu *>(menu);
|
||||||
Q_FOREACH (QCocoaMenuItem *item, cocoaMenu->items())
|
for (QCocoaMenuItem *item : cocoaMenu->items())
|
||||||
cocoaMenu->syncMenuItem_helper(item, menubarUpdate);
|
cocoaMenu->syncMenuItem_helper(item, menubarUpdate);
|
||||||
|
|
||||||
BOOL shouldHide = YES;
|
BOOL shouldHide = YES;
|
||||||
|
@ -117,7 +117,7 @@ QCocoaPrintDevice::~QCocoaPrintDevice()
|
|||||||
{
|
{
|
||||||
if (m_ppd)
|
if (m_ppd)
|
||||||
ppdClose(m_ppd);
|
ppdClose(m_ppd);
|
||||||
foreach (PMPaper paper, m_macPapers)
|
for (PMPaper paper : m_macPapers)
|
||||||
PMRelease(paper);
|
PMRelease(paper);
|
||||||
// Releasing the session appears to also release the printer
|
// Releasing the session appears to also release the printer
|
||||||
if (m_session)
|
if (m_session)
|
||||||
@ -171,7 +171,7 @@ QPageSize QCocoaPrintDevice::createPageSize(const PMPaper &paper) const
|
|||||||
void QCocoaPrintDevice::loadPageSizes() const
|
void QCocoaPrintDevice::loadPageSizes() const
|
||||||
{
|
{
|
||||||
m_pageSizes.clear();
|
m_pageSizes.clear();
|
||||||
foreach (PMPaper paper, m_macPapers)
|
for (PMPaper paper : m_macPapers)
|
||||||
PMRelease(paper);
|
PMRelease(paper);
|
||||||
m_macPapers.clear();
|
m_macPapers.clear();
|
||||||
m_printableMargins.clear();
|
m_printableMargins.clear();
|
||||||
|
@ -162,7 +162,7 @@ void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon)
|
|||||||
qreal devicePixelRatio = qApp->devicePixelRatio();
|
qreal devicePixelRatio = qApp->devicePixelRatio();
|
||||||
const int maxPixmapHeight = maxImageHeight * devicePixelRatio;
|
const int maxPixmapHeight = maxImageHeight * devicePixelRatio;
|
||||||
QSize selectedSize;
|
QSize selectedSize;
|
||||||
Q_FOREACH (const QSize& size, sortByHeight(icon.availableSizes())) {
|
for (const QSize& size : sortByHeight(icon.availableSizes())) {
|
||||||
// Select a pixmap based on the height. We want the largest pixmap
|
// Select a pixmap based on the height. We want the largest pixmap
|
||||||
// with a height smaller or equal to maxPixmapHeight. The pixmap
|
// with a height smaller or equal to maxPixmapHeight. The pixmap
|
||||||
// may rectangular; assume it has a reasonable size. If there is
|
// may rectangular; assume it has a reasonable size. If there is
|
||||||
|
@ -1833,7 +1833,7 @@ qreal QCocoaWindow::devicePixelRatio() const
|
|||||||
QWindow *QCocoaWindow::childWindowAt(QPoint windowPoint)
|
QWindow *QCocoaWindow::childWindowAt(QPoint windowPoint)
|
||||||
{
|
{
|
||||||
QWindow *targetWindow = window();
|
QWindow *targetWindow = window();
|
||||||
foreach (QObject *child, targetWindow->children())
|
for (QObject *child : targetWindow->children())
|
||||||
if (QWindow *childWindow = qobject_cast<QWindow *>(child))
|
if (QWindow *childWindow = qobject_cast<QWindow *>(child))
|
||||||
if (QPlatformWindow *handle = childWindow->handle())
|
if (QPlatformWindow *handle = childWindow->handle())
|
||||||
if (handle->isExposed() && childWindow->geometry().contains(windowPoint))
|
if (handle->isExposed() && childWindow->geometry().contains(windowPoint))
|
||||||
|
@ -184,7 +184,7 @@ QCocoaTouch::getCurrentTouchPointList(NSEvent *event, bool acceptSingleTouch)
|
|||||||
if (_touchCount != _currentTouches.size()) {
|
if (_touchCount != _currentTouches.size()) {
|
||||||
// Remove all instances, and basically start from scratch:
|
// Remove all instances, and basically start from scratch:
|
||||||
touchPoints.clear();
|
touchPoints.clear();
|
||||||
foreach (QCocoaTouch *qcocoaTouch, _currentTouches) {
|
for (QCocoaTouch *qcocoaTouch : _currentTouches) {
|
||||||
if (!_updateInternalStateOnly) {
|
if (!_updateInternalStateOnly) {
|
||||||
qcocoaTouch->_touchPoint.state = Qt::TouchPointReleased;
|
qcocoaTouch->_touchPoint.state = Qt::TouchPointReleased;
|
||||||
touchPoints.insert(qcocoaTouch->_touchPoint.id, qcocoaTouch->_touchPoint);
|
touchPoints.insert(qcocoaTouch->_touchPoint.id, qcocoaTouch->_touchPoint);
|
||||||
|
@ -485,7 +485,7 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
|
|||||||
int bestResolution = 0;
|
int bestResolution = 0;
|
||||||
int dpi = value.toInt();
|
int dpi = value.toInt();
|
||||||
int bestDistance = INT_MAX;
|
int bestDistance = INT_MAX;
|
||||||
foreach (int resolution, d->m_printDevice->supportedResolutions()) {
|
for (int resolution : d->m_printDevice->supportedResolutions()) {
|
||||||
if (dpi == resolution) {
|
if (dpi == resolution) {
|
||||||
bestResolution = resolution;
|
bestResolution = resolution;
|
||||||
break;
|
break;
|
||||||
@ -758,7 +758,7 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
|
|||||||
}
|
}
|
||||||
case PPK_SupportedResolutions: {
|
case PPK_SupportedResolutions: {
|
||||||
QList<QVariant> list;
|
QList<QVariant> list;
|
||||||
foreach (int resolution, d->m_printDevice->supportedResolutions())
|
for (int resolution : d->m_printDevice->supportedResolutions())
|
||||||
list << resolution;
|
list << resolution;
|
||||||
ret = list;
|
ret = list;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user