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);
|
Q_D(const QDeclarativePropertyChanges);
|
||||||
typedef QPair<QString, QVariant> PropertyEntry;
|
typedef QPair<QString, QVariant> PropertyEntry;
|
||||||
|
|
||||||
QListIterator<PropertyEntry> propertyIterator(d->properties);
|
foreach (const PropertyEntry &entry, d->properties) {
|
||||||
while (propertyIterator.hasNext()) {
|
|
||||||
const PropertyEntry &entry = propertyIterator.next();
|
|
||||||
if (entry.first == name) {
|
if (entry.first == name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -548,9 +546,7 @@ bool QDeclarativePropertyChanges::containsExpression(const QString &name) const
|
||||||
Q_D(const QDeclarativePropertyChanges);
|
Q_D(const QDeclarativePropertyChanges);
|
||||||
typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry;
|
typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry;
|
||||||
|
|
||||||
QListIterator<ExpressionEntry> expressionIterator(d->expressions);
|
foreach (const ExpressionEntry &entry, d->expressions) {
|
||||||
while (expressionIterator.hasNext()) {
|
|
||||||
const ExpressionEntry &entry = expressionIterator.next();
|
|
||||||
if (entry.name == name) {
|
if (entry.name == name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -705,17 +701,13 @@ QVariant QDeclarativePropertyChanges::property(const QString &name) const
|
||||||
typedef QPair<QString, QVariant> PropertyEntry;
|
typedef QPair<QString, QVariant> PropertyEntry;
|
||||||
typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry;
|
typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry;
|
||||||
|
|
||||||
QListIterator<PropertyEntry> propertyIterator(d->properties);
|
foreach (const PropertyEntry &entry, d->properties) {
|
||||||
while (propertyIterator.hasNext()) {
|
|
||||||
const PropertyEntry &entry = propertyIterator.next();
|
|
||||||
if (entry.first == name) {
|
if (entry.first == name) {
|
||||||
return entry.second;
|
return entry.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QListIterator<ExpressionEntry> expressionIterator(d->expressions);
|
foreach (const ExpressionEntry &entry, d->expressions) {
|
||||||
while (expressionIterator.hasNext()) {
|
|
||||||
const ExpressionEntry &entry = expressionIterator.next();
|
|
||||||
if (entry.name == name) {
|
if (entry.name == name) {
|
||||||
return QVariant(entry.expression->expression());
|
return QVariant(entry.expression->expression());
|
||||||
}
|
}
|
||||||
|
@ -756,9 +748,7 @@ QVariant QDeclarativePropertyChanges::value(const QString &name) const
|
||||||
Q_D(const QDeclarativePropertyChanges);
|
Q_D(const QDeclarativePropertyChanges);
|
||||||
typedef QPair<QString, QVariant> PropertyEntry;
|
typedef QPair<QString, QVariant> PropertyEntry;
|
||||||
|
|
||||||
QListIterator<PropertyEntry> propertyIterator(d->properties);
|
foreach (const PropertyEntry &entry, d->properties) {
|
||||||
while (propertyIterator.hasNext()) {
|
|
||||||
const PropertyEntry &entry = propertyIterator.next();
|
|
||||||
if (entry.first == name) {
|
if (entry.first == name) {
|
||||||
return entry.second;
|
return entry.second;
|
||||||
}
|
}
|
||||||
|
@ -772,9 +762,7 @@ QString QDeclarativePropertyChanges::expression(const QString &name) const
|
||||||
Q_D(const QDeclarativePropertyChanges);
|
Q_D(const QDeclarativePropertyChanges);
|
||||||
typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry;
|
typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry;
|
||||||
|
|
||||||
QListIterator<ExpressionEntry> expressionIterator(d->expressions);
|
foreach (const ExpressionEntry &entry, d->expressions) {
|
||||||
while (expressionIterator.hasNext()) {
|
|
||||||
const ExpressionEntry &entry = expressionIterator.next();
|
|
||||||
if (entry.name == name) {
|
if (entry.name == name) {
|
||||||
return entry.expression->expression();
|
return entry.expression->expression();
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,12 +342,12 @@ QDeclarativeStatePrivate::generateActionList(QDeclarativeStateGroup *group) cons
|
||||||
inState = true;
|
inState = true;
|
||||||
|
|
||||||
if (!extends.isEmpty()) {
|
if (!extends.isEmpty()) {
|
||||||
QList<QDeclarativeState *> states = group->states();
|
foreach (QDeclarativeState *state, group->states()) {
|
||||||
for (int ii = 0; ii < states.count(); ++ii)
|
if (state->name() == extends) {
|
||||||
if (states.at(ii)->name() == extends) {
|
qmlExecuteDeferred(state);
|
||||||
qmlExecuteDeferred(states.at(ii));
|
applyList = static_cast<QDeclarativeStatePrivate*>(state->d_func())->generateActionList(group);
|
||||||
applyList = static_cast<QDeclarativeStatePrivate*>(states.at(ii)->d_func())->generateActionList(group);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(QDeclarativeStateOperation *op, operations)
|
foreach(QDeclarativeStateOperation *op, operations)
|
||||||
|
@ -389,12 +389,9 @@ bool QDeclarativeState::containsPropertyInRevertList(QObject *target, const QStr
|
||||||
Q_D(const QDeclarativeState);
|
Q_D(const QDeclarativeState);
|
||||||
|
|
||||||
if (isStateActive()) {
|
if (isStateActive()) {
|
||||||
QListIterator<QDeclarativeSimpleAction> revertListIterator(d->revertList);
|
foreach (const QDeclarativeSimpleAction &simpleAction, d->revertList) {
|
||||||
|
if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name)
|
||||||
while (revertListIterator.hasNext()) {
|
return true;
|
||||||
const QDeclarativeSimpleAction &simpleAction = revertListIterator.next();
|
|
||||||
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);
|
Q_D(const QDeclarativeState);
|
||||||
|
|
||||||
if (isStateActive()) {
|
if (isStateActive()) {
|
||||||
QListIterator<QDeclarativeSimpleAction> revertListIterator(d->revertList);
|
foreach (const QDeclarativeSimpleAction &simpleAction, d->revertList) {
|
||||||
|
|
||||||
while (revertListIterator.hasNext()) {
|
|
||||||
const QDeclarativeSimpleAction &simpleAction = revertListIterator.next();
|
|
||||||
if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name)
|
if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name)
|
||||||
return simpleAction.value();
|
return simpleAction.value();
|
||||||
}
|
}
|
||||||
|
@ -553,10 +547,7 @@ QDeclarativeAbstractBinding *QDeclarativeState::bindingInRevertList(QObject *tar
|
||||||
Q_D(const QDeclarativeState);
|
Q_D(const QDeclarativeState);
|
||||||
|
|
||||||
if (isStateActive()) {
|
if (isStateActive()) {
|
||||||
QListIterator<QDeclarativeSimpleAction> revertListIterator(d->revertList);
|
foreach (const QDeclarativeSimpleAction &simpleAction, d->revertList) {
|
||||||
|
|
||||||
while (revertListIterator.hasNext()) {
|
|
||||||
const QDeclarativeSimpleAction &simpleAction = revertListIterator.next();
|
|
||||||
if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name)
|
if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name)
|
||||||
return simpleAction.binding();
|
return simpleAction.binding();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1678,10 +1678,7 @@ void WriteInitialization::writeColorGroup(DomColorGroup *colorGroup, const QStri
|
||||||
}
|
}
|
||||||
|
|
||||||
// new format
|
// new format
|
||||||
const QList<DomColorRole *> colorRoles = colorGroup->elementColorRole();
|
foreach (const DomColorRole *colorRole, colorGroup->elementColorRole()) {
|
||||||
QListIterator<DomColorRole *> itRole(colorRoles);
|
|
||||||
while (itRole.hasNext()) {
|
|
||||||
const DomColorRole *colorRole = itRole.next();
|
|
||||||
if (colorRole->hasAttributeRole()) {
|
if (colorRole->hasAttributeRole()) {
|
||||||
const QString brushName = writeBrushInitialization(colorRole->elementBrush());
|
const QString brushName = writeBrushInitialization(colorRole->elementBrush());
|
||||||
m_output << m_indent << paletteName << ".setBrush(" << group
|
m_output << m_indent << paletteName << ".setBrush(" << group
|
||||||
|
@ -1757,10 +1754,7 @@ void WriteInitialization::writeBrush(const DomBrush *brush, const QString &brush
|
||||||
<< gradient->attributeCoordinateMode() << ");\n";
|
<< gradient->attributeCoordinateMode() << ");\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<DomGradientStop *> stops = gradient->elementGradientStop();
|
foreach (const DomGradientStop *stop, gradient->elementGradientStop()) {
|
||||||
QListIterator<DomGradientStop *> it(stops);
|
|
||||||
while (it.hasNext()) {
|
|
||||||
const DomGradientStop *stop = it.next();
|
|
||||||
const DomColor *color = stop->elementColor();
|
const DomColor *color = stop->elementColor();
|
||||||
m_output << m_indent << gradientName << ".setColorAt("
|
m_output << m_indent << gradientName << ".setColorAt("
|
||||||
<< stop->attributePosition() << ", "
|
<< stop->attributePosition() << ", "
|
||||||
|
|
|
@ -1073,10 +1073,7 @@ QBrush QAbstractFormBuilder::setupBrush(DomBrush *brush)
|
||||||
const QGradient::CoordinateMode coord = enumKeyToValue<QGradient::CoordinateMode>(gradientCoordinate_enum, gradient->attributeCoordinateMode().toLatin1());
|
const QGradient::CoordinateMode coord = enumKeyToValue<QGradient::CoordinateMode>(gradientCoordinate_enum, gradient->attributeCoordinateMode().toLatin1());
|
||||||
gr->setCoordinateMode(coord);
|
gr->setCoordinateMode(coord);
|
||||||
|
|
||||||
const QList<DomGradientStop *> stops = gradient->elementGradientStop();
|
foreach (const DomGradientStop *stop, gradient->elementGradientStop()) {
|
||||||
QListIterator<DomGradientStop *> it(stops);
|
|
||||||
while (it.hasNext()) {
|
|
||||||
const DomGradientStop *stop = it.next();
|
|
||||||
const DomColor *color = stop->elementColor();
|
const DomColor *color = stop->elementColor();
|
||||||
gr->setColorAt(stop->attributePosition(), QColor::fromRgb(color->elementRed(),
|
gr->setColorAt(stop->attributePosition(), QColor::fromRgb(color->elementRed(),
|
||||||
color->elementGreen(), color->elementBlue(), color->attributeAlpha()));
|
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"));
|
const QList<QWidget *> zOrder = qvariant_cast<QWidgetList>(widget->property("_q_zOrder"));
|
||||||
if (list != zOrder) {
|
if (list != zOrder) {
|
||||||
QStringList zOrderList;
|
QStringList zOrderList;
|
||||||
QListIterator<QWidget* > itZOrder(zOrder);
|
foreach (const QWidget *w, zOrder) {
|
||||||
while (itZOrder.hasNext())
|
zOrderList.append(w->objectName());
|
||||||
zOrderList.append(itZOrder.next()->objectName());
|
}
|
||||||
ui_widget->setElementZOrder(zOrderList);
|
ui_widget->setElementZOrder(zOrderList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1347,11 +1344,9 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (QMenu *menu = qobject_cast<QMenu *>(childWidget)) {
|
if (QMenu *menu = qobject_cast<QMenu *>(childWidget)) {
|
||||||
QList<QAction *> actions = menu->parentWidget()->actions();
|
|
||||||
QListIterator<QAction *> it(actions);
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
while (it.hasNext()) {
|
foreach (const QAction *action, menu->parentWidget()->actions()) {
|
||||||
if (it.next()->menu() == menu)
|
if (action->menu() == menu)
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
|
|
Loading…
Add table
Reference in a new issue