mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
replace QListIterator<> with foreach() where applicable
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
5660f5ed0d
commit
f2993e0ccb
4 changed files with 24 additions and 56 deletions
|
@ -532,9 +532,7 @@ bool QDeclarativePropertyChanges::containsValue(const QString &name) const
|
|||
Q_D(const QDeclarativePropertyChanges);
|
||||
typedef QPair<QString, QVariant> PropertyEntry;
|
||||
|
||||
QListIterator<PropertyEntry> propertyIterator(d->properties);
|
||||
while (propertyIterator.hasNext()) {
|
||||
const PropertyEntry &entry = propertyIterator.next();
|
||||
foreach (const PropertyEntry &entry, d->properties) {
|
||||
if (entry.first == name) {
|
||||
return true;
|
||||
}
|
||||
|
@ -548,9 +546,7 @@ bool QDeclarativePropertyChanges::containsExpression(const QString &name) const
|
|||
Q_D(const QDeclarativePropertyChanges);
|
||||
typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry;
|
||||
|
||||
QListIterator<ExpressionEntry> expressionIterator(d->expressions);
|
||||
while (expressionIterator.hasNext()) {
|
||||
const ExpressionEntry &entry = expressionIterator.next();
|
||||
foreach (const ExpressionEntry &entry, d->expressions) {
|
||||
if (entry.name == name) {
|
||||
return true;
|
||||
}
|
||||
|
@ -705,17 +701,13 @@ QVariant QDeclarativePropertyChanges::property(const QString &name) const
|
|||
typedef QPair<QString, QVariant> PropertyEntry;
|
||||
typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry;
|
||||
|
||||
QListIterator<PropertyEntry> propertyIterator(d->properties);
|
||||
while (propertyIterator.hasNext()) {
|
||||
const PropertyEntry &entry = propertyIterator.next();
|
||||
foreach (const PropertyEntry &entry, d->properties) {
|
||||
if (entry.first == name) {
|
||||
return entry.second;
|
||||
}
|
||||
}
|
||||
|
||||
QListIterator<ExpressionEntry> expressionIterator(d->expressions);
|
||||
while (expressionIterator.hasNext()) {
|
||||
const ExpressionEntry &entry = expressionIterator.next();
|
||||
foreach (const ExpressionEntry &entry, d->expressions) {
|
||||
if (entry.name == name) {
|
||||
return QVariant(entry.expression->expression());
|
||||
}
|
||||
|
@ -756,9 +748,7 @@ QVariant QDeclarativePropertyChanges::value(const QString &name) const
|
|||
Q_D(const QDeclarativePropertyChanges);
|
||||
typedef QPair<QString, QVariant> PropertyEntry;
|
||||
|
||||
QListIterator<PropertyEntry> propertyIterator(d->properties);
|
||||
while (propertyIterator.hasNext()) {
|
||||
const PropertyEntry &entry = propertyIterator.next();
|
||||
foreach (const PropertyEntry &entry, d->properties) {
|
||||
if (entry.first == name) {
|
||||
return entry.second;
|
||||
}
|
||||
|
@ -772,9 +762,7 @@ QString QDeclarativePropertyChanges::expression(const QString &name) const
|
|||
Q_D(const QDeclarativePropertyChanges);
|
||||
typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry;
|
||||
|
||||
QListIterator<ExpressionEntry> expressionIterator(d->expressions);
|
||||
while (expressionIterator.hasNext()) {
|
||||
const ExpressionEntry &entry = expressionIterator.next();
|
||||
foreach (const ExpressionEntry &entry, d->expressions) {
|
||||
if (entry.name == name) {
|
||||
return entry.expression->expression();
|
||||
}
|
||||
|
|
|
@ -342,11 +342,11 @@ QDeclarativeStatePrivate::generateActionList(QDeclarativeStateGroup *group) cons
|
|||
inState = true;
|
||||
|
||||
if (!extends.isEmpty()) {
|
||||
QList<QDeclarativeState *> states = group->states();
|
||||
for (int ii = 0; ii < states.count(); ++ii)
|
||||
if (states.at(ii)->name() == extends) {
|
||||
qmlExecuteDeferred(states.at(ii));
|
||||
applyList = static_cast<QDeclarativeStatePrivate*>(states.at(ii)->d_func())->generateActionList(group);
|
||||
foreach (QDeclarativeState *state, group->states()) {
|
||||
if (state->name() == extends) {
|
||||
qmlExecuteDeferred(state);
|
||||
applyList = static_cast<QDeclarativeStatePrivate*>(state->d_func())->generateActionList(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,10 +389,7 @@ bool QDeclarativeState::containsPropertyInRevertList(QObject *target, const QStr
|
|||
Q_D(const QDeclarativeState);
|
||||
|
||||
if (isStateActive()) {
|
||||
QListIterator<QDeclarativeSimpleAction> revertListIterator(d->revertList);
|
||||
|
||||
while (revertListIterator.hasNext()) {
|
||||
const QDeclarativeSimpleAction &simpleAction = revertListIterator.next();
|
||||
foreach (const QDeclarativeSimpleAction &simpleAction, d->revertList) {
|
||||
if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name)
|
||||
return true;
|
||||
}
|
||||
|
@ -536,10 +533,7 @@ QVariant QDeclarativeState::valueInRevertList(QObject *target, const QString &na
|
|||
Q_D(const QDeclarativeState);
|
||||
|
||||
if (isStateActive()) {
|
||||
QListIterator<QDeclarativeSimpleAction> revertListIterator(d->revertList);
|
||||
|
||||
while (revertListIterator.hasNext()) {
|
||||
const QDeclarativeSimpleAction &simpleAction = revertListIterator.next();
|
||||
foreach (const QDeclarativeSimpleAction &simpleAction, d->revertList) {
|
||||
if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name)
|
||||
return simpleAction.value();
|
||||
}
|
||||
|
@ -553,10 +547,7 @@ QDeclarativeAbstractBinding *QDeclarativeState::bindingInRevertList(QObject *tar
|
|||
Q_D(const QDeclarativeState);
|
||||
|
||||
if (isStateActive()) {
|
||||
QListIterator<QDeclarativeSimpleAction> revertListIterator(d->revertList);
|
||||
|
||||
while (revertListIterator.hasNext()) {
|
||||
const QDeclarativeSimpleAction &simpleAction = revertListIterator.next();
|
||||
foreach (const QDeclarativeSimpleAction &simpleAction, d->revertList) {
|
||||
if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name)
|
||||
return simpleAction.binding();
|
||||
}
|
||||
|
|
|
@ -1678,10 +1678,7 @@ void WriteInitialization::writeColorGroup(DomColorGroup *colorGroup, const QStri
|
|||
}
|
||||
|
||||
// new format
|
||||
const QList<DomColorRole *> colorRoles = colorGroup->elementColorRole();
|
||||
QListIterator<DomColorRole *> itRole(colorRoles);
|
||||
while (itRole.hasNext()) {
|
||||
const DomColorRole *colorRole = itRole.next();
|
||||
foreach (const DomColorRole *colorRole, colorGroup->elementColorRole()) {
|
||||
if (colorRole->hasAttributeRole()) {
|
||||
const QString brushName = writeBrushInitialization(colorRole->elementBrush());
|
||||
m_output << m_indent << paletteName << ".setBrush(" << group
|
||||
|
@ -1757,10 +1754,7 @@ void WriteInitialization::writeBrush(const DomBrush *brush, const QString &brush
|
|||
<< gradient->attributeCoordinateMode() << ");\n";
|
||||
}
|
||||
|
||||
const QList<DomGradientStop *> stops = gradient->elementGradientStop();
|
||||
QListIterator<DomGradientStop *> it(stops);
|
||||
while (it.hasNext()) {
|
||||
const DomGradientStop *stop = it.next();
|
||||
foreach (const DomGradientStop *stop, gradient->elementGradientStop()) {
|
||||
const DomColor *color = stop->elementColor();
|
||||
m_output << m_indent << gradientName << ".setColorAt("
|
||||
<< stop->attributePosition() << ", "
|
||||
|
|
|
@ -1073,10 +1073,7 @@ QBrush QAbstractFormBuilder::setupBrush(DomBrush *brush)
|
|||
const QGradient::CoordinateMode coord = enumKeyToValue<QGradient::CoordinateMode>(gradientCoordinate_enum, gradient->attributeCoordinateMode().toLatin1());
|
||||
gr->setCoordinateMode(coord);
|
||||
|
||||
const QList<DomGradientStop *> stops = gradient->elementGradientStop();
|
||||
QListIterator<DomGradientStop *> it(stops);
|
||||
while (it.hasNext()) {
|
||||
const DomGradientStop *stop = it.next();
|
||||
foreach (const DomGradientStop *stop, gradient->elementGradientStop()) {
|
||||
const DomColor *color = stop->elementColor();
|
||||
gr->setColorAt(stop->attributePosition(), QColor::fromRgb(color->elementRed(),
|
||||
color->elementGreen(), color->elementBlue(), color->attributeAlpha()));
|
||||
|
@ -1334,9 +1331,9 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent
|
|||
const QList<QWidget *> zOrder = qvariant_cast<QWidgetList>(widget->property("_q_zOrder"));
|
||||
if (list != zOrder) {
|
||||
QStringList zOrderList;
|
||||
QListIterator<QWidget* > itZOrder(zOrder);
|
||||
while (itZOrder.hasNext())
|
||||
zOrderList.append(itZOrder.next()->objectName());
|
||||
foreach (const QWidget *w, zOrder) {
|
||||
zOrderList.append(w->objectName());
|
||||
}
|
||||
ui_widget->setElementZOrder(zOrderList);
|
||||
}
|
||||
}
|
||||
|
@ -1347,11 +1344,9 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent
|
|||
continue;
|
||||
|
||||
if (QMenu *menu = qobject_cast<QMenu *>(childWidget)) {
|
||||
QList<QAction *> actions = menu->parentWidget()->actions();
|
||||
QListIterator<QAction *> it(actions);
|
||||
bool found = false;
|
||||
while (it.hasNext()) {
|
||||
if (it.next()->menu() == menu)
|
||||
foreach (const QAction *action, menu->parentWidget()->actions()) {
|
||||
if (action->menu() == menu)
|
||||
found = true;
|
||||
}
|
||||
if (!found)
|
||||
|
|
Loading…
Add table
Reference in a new issue