QuickWidgets: replace 'foreach' with 'range for'
And add QT_NO_FOREACH define to .pro file. Now QuickWidgets is 'foreach' free. Change-Id: Iff711ab3a8bb78188aac48371f6e45eb4b174699 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
d39d23b9f2
commit
4a7e03fc70
|
@ -575,8 +575,8 @@ void QQuickWidget::setContent(const QUrl& url, QQmlComponent *component, QObject
|
|||
d->component = component;
|
||||
|
||||
if (d->component && d->component->isError()) {
|
||||
QList<QQmlError> errorList = d->component->errors();
|
||||
foreach (const QQmlError &error, errorList) {
|
||||
const QList<QQmlError> errorList = d->component->errors();
|
||||
for (const QQmlError &error : errorList) {
|
||||
QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning()
|
||||
<< error;
|
||||
}
|
||||
|
@ -1018,8 +1018,8 @@ void QQuickWidget::continueExecute()
|
|||
disconnect(d->component, SIGNAL(statusChanged(QQmlComponent::Status)), this, SLOT(continueExecute()));
|
||||
|
||||
if (d->component->isError()) {
|
||||
QList<QQmlError> errorList = d->component->errors();
|
||||
foreach (const QQmlError &error, errorList) {
|
||||
const QList<QQmlError> errorList = d->component->errors();
|
||||
for (const QQmlError &error : errorList) {
|
||||
QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning()
|
||||
<< error;
|
||||
}
|
||||
|
@ -1030,8 +1030,8 @@ void QQuickWidget::continueExecute()
|
|||
QObject *obj = d->component->create();
|
||||
|
||||
if (d->component->isError()) {
|
||||
QList<QQmlError> errorList = d->component->errors();
|
||||
foreach (const QQmlError &error, errorList) {
|
||||
const QList<QQmlError> errorList = d->component->errors();
|
||||
for (const QQmlError &error : errorList) {
|
||||
QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning()
|
||||
<< error;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ TARGET = QtQuickWidgets
|
|||
|
||||
QT = core-private gui-private qml-private quick-private widgets-private
|
||||
|
||||
DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_INTEGER_EVENT_COORDINATES
|
||||
DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_INTEGER_EVENT_COORDINATES QT_NO_FOREACH
|
||||
|
||||
HEADERS += \
|
||||
qquickwidget.h \
|
||||
|
|
Loading…
Reference in New Issue