summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qfxglobal.h4
-rw-r--r--src/declarative/util/qfxview.cpp22
-rw-r--r--src/declarative/util/qmlanimation.cpp278
-rw-r--r--src/declarative/util/qmlanimation_p.h2
-rw-r--r--src/declarative/util/qmlbehaviour.cpp10
-rw-r--r--src/declarative/util/qmlbind.cpp2
-rw-r--r--src/declarative/util/qmlconnection.cpp6
-rw-r--r--src/declarative/util/qmllistaccessor.cpp12
-rw-r--r--src/declarative/util/qmllistmodel.cpp80
-rw-r--r--src/declarative/util/qmlopenmetaobject.cpp22
-rw-r--r--src/declarative/util/qmlpackage.cpp12
-rw-r--r--src/declarative/util/qmlscript.cpp2
-rw-r--r--src/declarative/util/qmlscript.h2
-rw-r--r--src/declarative/util/qmlsetproperties.cpp10
-rw-r--r--src/declarative/util/qmlstate.cpp66
-rw-r--r--src/declarative/util/qmlstategroup.cpp70
-rw-r--r--src/declarative/util/qmlstateoperations.cpp16
-rw-r--r--src/declarative/util/qmltransition.cpp6
-rw-r--r--src/declarative/util/qperformancelog.cpp20
19 files changed, 322 insertions, 320 deletions
diff --git a/src/declarative/util/qfxglobal.h b/src/declarative/util/qfxglobal.h
index 52cf021..887351d 100644
--- a/src/declarative/util/qfxglobal.h
+++ b/src/declarative/util/qfxglobal.h
@@ -88,10 +88,10 @@ QT_MODULE(Declarative)
static bool name() \
{ \
static enum { Yes, No, Unknown } status = Unknown; \
- if(status == Unknown) { \
+ if (status == Unknown) { \
QByteArray v = qgetenv(#var); \
bool value = !v.isEmpty() && v != "0" && v != "false"; \
- if(value) status = Yes; \
+ if (value) status = Yes; \
else status = No; \
} \
return status == Yes; \
diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp
index 993d5cb..1e9d5a4 100644
--- a/src/declarative/util/qfxview.cpp
+++ b/src/declarative/util/qfxview.cpp
@@ -200,7 +200,7 @@ void QFxView::execute()
d->component = new QmlComponent(&d->engine, d->xml.toUtf8(), d->source);
}
- if(!d->component->isLoading()) {
+ if (!d->component->isLoading()) {
continueExecute();
} else {
connect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute()));
@@ -211,18 +211,18 @@ void QFxView::continueExecute()
{
disconnect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute()));
- if(!d->component){
+ if (!d->component){
qWarning() << "Error in loading" << d->source;
return;
}
QObject *obj = d->component->create();
rootContext()->deactivate();
- if(obj) {
- if(QFxItem *item = qobject_cast<QFxItem *>(obj)) {
+ if (obj) {
+ if (QFxItem *item = qobject_cast<QFxItem *>(obj)) {
item->QSimpleCanvasItem::setParent(QSimpleCanvas::root());
- if(itemTreeDump())
+ if (itemTreeDump())
item->dump();
QPerformanceLog::displayData();
@@ -231,7 +231,7 @@ void QFxView::continueExecute()
connect(item, SIGNAL(widthChanged()), this, SLOT(sizeChanged()));
connect(item, SIGNAL(heightChanged()), this, SLOT(sizeChanged()));
sizeChanged();
- } else if(QWidget *wid = qobject_cast<QWidget *>(obj)) {
+ } else if (QWidget *wid = qobject_cast<QWidget *>(obj)) {
window()->setAttribute(Qt::WA_OpaquePaintEvent, false);
window()->setAttribute(Qt::WA_NoSystemBackground, false);
if (!layout()) {
@@ -256,14 +256,14 @@ void QFxView::sizeChanged()
QFxItem* QFxView::addItem(const QString &xml, QFxItem* parent)
{
- if(!d->root)
+ if (!d->root)
return 0;
QmlComponent component(&d->engine, xml.toUtf8(), QUrl());
QObject *obj = component.create();
- if(obj){
+ if (obj){
QFxItem *item = static_cast<QFxItem *>(obj);
- if(!parent)
+ if (!parent)
parent = d->root;
item->setItemParent(parent);
@@ -280,7 +280,7 @@ void QFxView::reset()
void QFxView::clearItems()
{
- if(!d->root)
+ if (!d->root)
return;
delete d->root;
d->root = 0;
@@ -293,7 +293,7 @@ QFxItem *QFxView::root() const
void QFxView::resizeEvent(QResizeEvent *e)
{
- if(d->root) {
+ if (d->root) {
d->root->setWidth(width());
d->root->setHeight(height());
}
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index 91a5361..c09b378 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -73,9 +73,9 @@ QEasingCurve stringToCurve(const QString &curve)
bool hasParams = curve.contains(QLatin1Char('('));
QStringList props;
- if(hasParams) {
+ if (hasParams) {
QString easeName = curve.trimmed();
- if(!easeName.endsWith(QLatin1Char(')'))) {
+ if (!easeName.endsWith(QLatin1Char(')'))) {
qWarning("QEasingCurve: Unmatched perenthesis in easing function '%s'",
curve.toLatin1().constData());
return easingCurve;
@@ -104,10 +104,10 @@ QEasingCurve stringToCurve(const QString &curve)
easingCurve.setType((QEasingCurve::Type)value);
if (hasParams) {
- foreach(QString str, props) {
+ foreach(const QString &str, props) {
int sep = str.indexOf(QLatin1Char(':'));
- if(sep == -1) {
+ if (sep == -1) {
qWarning("QEasingCurve: Improperly specified property in easing function '%s'",
curve.toLatin1().constData());
return easingCurve;
@@ -117,7 +117,7 @@ QEasingCurve stringToCurve(const QString &curve)
bool isOk;
qreal propValue = str.mid(sep + 1).trimmed().toDouble(&isOk);
- if(propName.isEmpty() || !isOk) {
+ if (propName.isEmpty() || !isOk) {
qWarning("QEasingCurve: Improperly specified property in easing function '%s'",
curve.toLatin1().constData());
return easingCurve;
@@ -188,13 +188,13 @@ QmlAbstractAnimation::QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObj
Likewise, the \c running property can be read to determine if the animation
is running. In the following example the text element will indicate whether
or not the animation is running.
-
+
\code
<NumericAnimation id="MyAnimation" />
<Text text="{MyAnimation.running?'Animation is running':'Animation is not running'}" />
\endcode
- Animations can also be started and stopped imperatively from JavaScript
+ Animations can also be started and stopped imperatively from JavaScript
using the \c start() and \c stop() methods.
By default, animations are not running.
@@ -211,7 +211,7 @@ void QmlAbstractAnimationPrivate::commence()
q->prepare(userProperty.value);
q->qtAnimation()->start();
- if(!q->qtAnimation()->state() == QAbstractAnimation::Running) {
+ if (!q->qtAnimation()->state() == QAbstractAnimation::Running) {
running = false;
emit q->completed();
}
@@ -220,17 +220,17 @@ void QmlAbstractAnimationPrivate::commence()
void QmlAbstractAnimation::setRunning(bool r)
{
Q_D(QmlAbstractAnimation);
- if(d->running == r)
+ if (d->running == r)
return;
- if(d->group) {
+ if (d->group) {
qWarning("QmlAbstractAnimation: setRunning() cannot be used on non-root animation nodes");
return;
}
d->running = r;
- if(d->running) {
- if(!d->connectedTimeLine) {
+ if (d->running) {
+ if (!d->connectedTimeLine) {
QObject::connect(qtAnimation(), SIGNAL(finished()),
this, SLOT(timelineComplete()));
d->connectedTimeLine = true;
@@ -241,7 +241,7 @@ void QmlAbstractAnimation::setRunning(bool r)
d->startOnCompletion = true;
emit started();
} else {
- if(!d->finishPlaying)
+ if (!d->finishPlaying)
qtAnimation()->stop();
emit completed();
}
@@ -272,7 +272,7 @@ void QmlAbstractAnimation::componentComplete()
calling the \c stop() method. The \c complete() method is not effected
by this value.
- This behaviour is most useful when the \c repeat property is set, as the
+ This behaviour is most useful when the \c repeat property is set, as the
animation will finish playing normally but not restart.
By default, the finishPlaying property is not set.
@@ -286,7 +286,7 @@ bool QmlAbstractAnimation::finishPlaying() const
void QmlAbstractAnimation::setFinishPlaying(bool f)
{
Q_D(QmlAbstractAnimation);
- if(d->finishPlaying == f)
+ if (d->finishPlaying == f)
return;
d->finishPlaying = f;
@@ -297,7 +297,7 @@ void QmlAbstractAnimation::setFinishPlaying(bool f)
\qmlproperty bool Animation::repeat
This property holds whether the animation should repeat.
- If set, the animation will continuously repeat until it is explicitly
+ If set, the animation will continuously repeat until it is explicitly
stopped - either by setting the \c running property to false, or by calling
the \c stop() method.
@@ -320,7 +320,7 @@ bool QmlAbstractAnimation::repeat() const
void QmlAbstractAnimation::setRepeat(bool r)
{
Q_D(QmlAbstractAnimation);
- if(r == d->repeat)
+ if (r == d->repeat)
return;
d->repeat = r;
@@ -338,20 +338,20 @@ QmlAnimationGroup *QmlAbstractAnimation::group() const
void QmlAbstractAnimation::setGroup(QmlAnimationGroup *g)
{
Q_D(QmlAbstractAnimation);
- if(d->group == g)
+ if (d->group == g)
return;
- if(d->group)
+ if (d->group)
static_cast<QmlAnimationGroupPrivate *>(d->group->d_ptr)->animations.removeAll(this);
d->group = g;
- if(d->group && !static_cast<QmlAnimationGroupPrivate *>(d->group->d_ptr)->animations.contains(this))
+ if (d->group && !static_cast<QmlAnimationGroupPrivate *>(d->group->d_ptr)->animations.contains(this))
static_cast<QmlAnimationGroupPrivate *>(d->group->d_ptr)->animations.append(this);
if (d->group)
((QAnimationGroup*)d->group->qtAnimation())->addAnimation(qtAnimation());
- //if(g) //if removed from a group, then the group should no longer be the parent
+ //if (g) //if removed from a group, then the group should no longer be the parent
setParent(g);
}
@@ -371,11 +371,11 @@ QObject *QmlAbstractAnimation::target() const
void QmlAbstractAnimation::setTarget(QObject *o)
{
Q_D(QmlAbstractAnimation);
- if(d->target == o)
+ if (d->target == o)
return;
d->target = o;
- if(d->target && !d->propertyName.isEmpty()) {
+ if (d->target && !d->propertyName.isEmpty()) {
d->userProperty = QmlMetaProperty(d->target, d->propertyName);
} else {
d->userProperty.invalidate();
@@ -400,11 +400,11 @@ QString QmlAbstractAnimation::property() const
void QmlAbstractAnimation::setProperty(const QString &n)
{
Q_D(QmlAbstractAnimation);
- if(d->propertyName == n)
+ if (d->propertyName == n)
return;
d->propertyName = n;
- if(d->target && !d->propertyName.isEmpty()) {
+ if (d->target && !d->propertyName.isEmpty()) {
d->userProperty = QmlMetaProperty(d->target, d->propertyName);
} else {
d->userProperty.invalidate();
@@ -443,7 +443,7 @@ void QmlAbstractAnimation::start()
\endcode
was stopped at time 250ms, the \c x property will have a value of 50.
- However, if the \c finishPlaying property is set, the animation will
+ However, if the \c finishPlaying property is set, the animation will
continue running until it completes and then stop. The \c running property
will still become false immediately.
*/
@@ -482,12 +482,12 @@ void QmlAbstractAnimation::restart()
</Rect>
\endcode
calling \c stop() at time 250ms will result in the \c x property having
- a value of 50, while calling \c complete() will set the \c x property to
+ a value of 50, while calling \c complete() will set the \c x property to
100, exactly as though the animation had played the whole way through.
*/
void QmlAbstractAnimation::complete()
{
- if(isRunning()) {
+ if (isRunning()) {
qtAnimation()->setCurrentTime(qtAnimation()->duration());
}
}
@@ -495,7 +495,7 @@ void QmlAbstractAnimation::complete()
void QmlAbstractAnimation::setTarget(const QmlMetaProperty &p)
{
Q_D(QmlAbstractAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->userProperty = p;
}
@@ -588,13 +588,13 @@ int QmlPauseAnimation::duration() const
void QmlPauseAnimation::setDuration(int duration)
{
- if(duration < 0) {
+ if (duration < 0) {
qWarning("QmlPauseAnimation: Cannot set a duration of < 0");
return;
}
Q_D(QmlPauseAnimation);
- if(d->pa->duration() == duration)
+ if (d->pa->duration() == duration)
return;
d->pa->setDuration(duration);
emit durationChanged(duration);
@@ -603,7 +603,7 @@ void QmlPauseAnimation::setDuration(int duration)
void QmlPauseAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlPauseAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -678,13 +678,13 @@ int QmlColorAnimation::duration() const
void QmlColorAnimation::setDuration(int duration)
{
- if(duration < 0) {
+ if (duration < 0) {
qWarning("QmlColorAnimation: Cannot set a duration of < 0");
return;
}
Q_D(QmlColorAnimation);
- if(d->ca->duration() == duration)
+ if (d->ca->duration() == duration)
return;
d->ca->setDuration(duration);
emit durationChanged(duration);
@@ -707,7 +707,7 @@ QColor QmlColorAnimation::from() const
void QmlColorAnimation::setFrom(const QColor &f)
{
Q_D(QmlColorAnimation);
- if(d->fromValue.isValid() && f == d->fromValue)
+ if (d->fromValue.isValid() && f == d->fromValue)
return;
d->fromValue = f;
emit fromChanged(f);
@@ -730,7 +730,7 @@ QColor QmlColorAnimation::to() const
void QmlColorAnimation::setTo(const QColor &t)
{
Q_D(QmlColorAnimation);
- if(d->toValue.isValid() && t == d->toValue)
+ if (d->toValue.isValid() && t == d->toValue)
return;
d->toValue = t;
emit toChanged(t);
@@ -753,7 +753,7 @@ QString QmlColorAnimation::easing() const
void QmlColorAnimation::setEasing(const QString &e)
{
Q_D(QmlColorAnimation);
- if(d->easing == e)
+ if (d->easing == e)
return;
d->easing = e;
@@ -766,7 +766,7 @@ void QmlColorAnimation::setEasing(const QString &e)
This property holds the items selected to be affected by this animation (all if not set).
\sa exclude
*/
-QList<QObject *> *QmlColorAnimation::filter()
+QList<QObject *> *QmlColorAnimation::filter()
{
Q_D(QmlColorAnimation);
return &d->filter;
@@ -786,7 +786,7 @@ QList<QObject *> *QmlColorAnimation::exclude()
void QmlColorAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlColorAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -813,7 +813,7 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
QmlStateActions actions;
void write(QmlMetaProperty &property, const QColor &color)
{
- if(property.propertyType() == qMetaTypeId<QColor>()) {
+ if (property.propertyType() == qMetaTypeId<QColor>()) {
property.write(color);
}
}
@@ -821,17 +821,17 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
void setValue(qreal v)
{
QmlTimeLineValue::setValue(v);
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QColor to(action.toValue.value<QColor>());
- if(v == 1.) {
+ if (v == 1.) {
write(action.property, to);
} else {
- if(action.fromValue.isNull()) {
+ if (action.fromValue.isNull()) {
action.fromValue = action.property.read();
- if(action.fromValue.isNull())
+ if (action.fromValue.isNull())
action.fromValue = QVariant(QColor());
}
@@ -852,26 +852,26 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
//XXX should we get rid of this?
QStringList props;
props << QLatin1String("color");
- if(!d->propertyName.isEmpty() && !props.contains(d->propertyName))
+ if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
NTransitionData *data = new NTransitionData;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((d->filter.isEmpty() || d->filter.contains(obj)) &&
+ if ((d->filter.isEmpty() || d->filter.contains(obj)) &&
(!d->exclude.contains(obj)) && props.contains(propertyName) &&
(!target() || target() == obj)) {
objs.insert(obj);
Action myAction = action;
- if(d->fromValue.isValid())
+ if (d->fromValue.isValid())
myAction.fromValue = QVariant(d->fromValue);
- if(d->toValue.isValid())
+ if (d->toValue.isValid())
myAction.toValue = QVariant(d->toValue);
modified << action.property;
@@ -880,13 +880,13 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
}
}
- if(d->toValue.isValid() && target() && !objs.contains(target())) {
+ if (d->toValue.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
- if(d->fromValue.isValid())
+ if (d->fromValue.isValid())
myAction.fromValue = QVariant(d->fromValue);
myAction.toValue = QVariant(d->toValue);
@@ -896,7 +896,7 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
}
}
- if(data->actions.count())
+ if (data->actions.count())
d->ca->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
else
delete data;
@@ -905,8 +905,8 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
void QmlColorAnimationPrivate::valueChanged(qreal v)
{
- if(!fromSourced) {
- if(!fromValue.isValid()) {
+ if (!fromSourced) {
+ if (!fromValue.isValid()) {
fromValue = QColor(qvariant_cast<QColor>(property.read()));
}
fromSourced = true;
@@ -918,7 +918,7 @@ void QmlColorAnimationPrivate::valueChanged(qreal v)
uint blue = uint(qreal(fromValue.blue()) + v * (qreal(toValue.blue()) - qreal(fromValue.blue())));
uint alpha = uint(qreal(fromValue.alpha()) + v * (qreal(toValue.alpha()) - qreal(fromValue.alpha())));
- if(property.propertyType() == qMetaTypeId<QColor>()) {
+ if (property.propertyType() == qMetaTypeId<QColor>()) {
property.write(QColor(red, green, blue, alpha));
}
}
@@ -967,7 +967,7 @@ QString QmlRunScriptAction::script() const
void QmlRunScriptAction::setScript(const QString &script)
{
Q_D(QmlRunScriptAction);
- if(script == d->script)
+ if (script == d->script)
return;
d->script = script;
emit scriptChanged(script);
@@ -986,7 +986,7 @@ QString QmlRunScriptAction::file() const
void QmlRunScriptAction::setFile(const QString &file)
{
Q_D(QmlRunScriptAction);
- if(file == d->file)
+ if (file == d->file)
return;
d->file = file;
emit fileChanged(file);
@@ -996,14 +996,14 @@ void QmlRunScriptActionPrivate::execute()
{
Q_Q(QmlRunScriptAction);
QString scriptStr = script;
- if(!file.isEmpty()){
+ if (!file.isEmpty()){
QFile scriptFile(file);
- if(scriptFile.open(QIODevice::ReadOnly | QIODevice::Text)){
+ if (scriptFile.open(QIODevice::ReadOnly | QIODevice::Text)){
scriptStr = QString::fromUtf8(scriptFile.readAll());
}
}
- if(!scriptStr.isEmpty()) {
+ if (!scriptStr.isEmpty()) {
QmlExpression expr(qmlContext(q), scriptStr, q);
expr.setTrackChange(false);
expr.value();
@@ -1074,7 +1074,7 @@ QString QmlSetPropertyAction::properties() const
void QmlSetPropertyAction::setProperties(const QString &p)
{
Q_D(QmlSetPropertyAction);
- if(d->properties == p)
+ if (d->properties == p)
return;
d->properties = p;
emit propertiesChanged(p);
@@ -1116,7 +1116,7 @@ QVariant QmlSetPropertyAction::value() const
void QmlSetPropertyAction::setValue(const QVariant &v)
{
Q_D(QmlSetPropertyAction);
- if(d->value.isNull || d->value != v) {
+ if (d->value.isNull || d->value != v) {
d->value = v;
emit valueChanged(v);
}
@@ -1137,7 +1137,7 @@ void QmlSetPropertyAction::prepare(QmlMetaProperty &p)
{
Q_D(QmlSetPropertyAction);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -1157,7 +1157,7 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions,
QmlStateActions actions;
virtual void doAction()
{
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
const Action &action = actions.at(ii);
QmlBehaviour::_ignore = true;
action.property.write(action.toValue);
@@ -1167,27 +1167,27 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions,
};
QStringList props = d->properties.split(QLatin1Char(','));
- for(int ii = 0; ii < props.count(); ++ii)
+ for (int ii = 0; ii < props.count(); ++ii)
props[ii] = props.at(ii).trimmed();
- if(!d->propertyName.isEmpty() && !props.contains(d->propertyName))
+ if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
QmlSetPropertyAnimationAction *data = new QmlSetPropertyAnimationAction;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((d->filter.isEmpty() || d->filter.contains(obj)) &&
+ if ((d->filter.isEmpty() || d->filter.contains(obj)) &&
(!d->exclude.contains(obj)) && props.contains(propertyName) &&
(!target() || target() == obj)) {
objs.insert(obj);
Action myAction = action;
- if(d->value.isValid())
+ if (d->value.isValid())
myAction.toValue = d->value;
modified << action.property;
@@ -1196,9 +1196,9 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions,
}
}
- if(d->value.isValid() && target() && !objs.contains(target())) {
+ if (d->value.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
myAction.toValue = d->value;
@@ -1206,7 +1206,7 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions,
}
}
- if(data->actions.count()) {
+ if (data->actions.count()) {
d->spa->setAnimAction(data, QAbstractAnimation::DeleteWhenStopped);
} else {
delete data;
@@ -1249,9 +1249,9 @@ void QmlParentChangeAction::prepare(QmlMetaProperty &p)
{
Q_D(QmlParentChangeAction);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
- else
+ else
d->property = d->userProperty;
//XXX
@@ -1275,7 +1275,7 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
QmlStateActions actions;
virtual void doAction()
{
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
const Action &action = actions.at(ii);
QmlBehaviour::_ignore = true;
action.property.write(action.toValue);
@@ -1287,17 +1287,17 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
QmlParentChangeActionData *data = new QmlParentChangeActionData;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((!target() || target() == obj) && propertyName == QString(QLatin1String("moveToParent"))) {
+ if ((!target() || target() == obj) && propertyName == QString(QLatin1String("moveToParent"))) {
objs.insert(obj);
Action myAction = action;
- /*if(d->value.isValid())
+ /*if (d->value.isValid())
myAction.toValue = d->value;*/
modified << action.property;
@@ -1306,9 +1306,9 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
}
}
- /*if(d->value.isValid() && target() && !objs.contains(target())) {
+ /*if (d->value.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
myAction.toValue = d->value;
@@ -1316,7 +1316,7 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
}
}*/
- if(data->actions.count()) {
+ if (data->actions.count()) {
d->cpa->setAnimAction(data, QAbstractAnimation::DeleteWhenStopped);
} else {
delete data;
@@ -1387,13 +1387,13 @@ int QmlNumericAnimation::duration() const
void QmlNumericAnimation::setDuration(int duration)
{
- if(duration < 0) {
+ if (duration < 0) {
qWarning("QmlNumericAnimation: Cannot set a duration of < 0");
return;
}
Q_D(QmlNumericAnimation);
- if(d->na->duration() == duration)
+ if (d->na->duration() == duration)
return;
d->na->setDuration(duration);
emit durationChanged(duration);
@@ -1417,7 +1417,7 @@ qreal QmlNumericAnimation::from() const
void QmlNumericAnimation::setFrom(qreal f)
{
Q_D(QmlNumericAnimation);
- if(!d->from.isNull && f == d->from)
+ if (!d->from.isNull && f == d->from)
return;
d->from = f;
emit fromChanged(f);
@@ -1441,7 +1441,7 @@ qreal QmlNumericAnimation::to() const
void QmlNumericAnimation::setTo(qreal t)
{
Q_D(QmlNumericAnimation);
- if(!d->to.isNull && t == d->to)
+ if (!d->to.isNull && t == d->to)
return;
d->to = t;
emit toChanged(t);
@@ -1513,7 +1513,7 @@ QString QmlNumericAnimation::easing() const
void QmlNumericAnimation::setEasing(const QString &e)
{
Q_D(QmlNumericAnimation);
- if(d->easing == e)
+ if (d->easing == e)
return;
d->easing = e;
@@ -1544,7 +1544,7 @@ QString QmlNumericAnimation::properties() const
void QmlNumericAnimation::setProperties(const QString &prop)
{
Q_D(QmlNumericAnimation);
- if(d->properties == prop)
+ if (d->properties == prop)
return;
d->properties = prop;
@@ -1556,7 +1556,7 @@ void QmlNumericAnimation::setProperties(const QString &prop)
This property holds the items selected to be affected by this animation (all if not set).
\sa exclude
*/
-QList<QObject *> *QmlNumericAnimation::filter()
+QList<QObject *> *QmlNumericAnimation::filter()
{
Q_D(QmlNumericAnimation);
return &d->filter;
@@ -1575,8 +1575,8 @@ QList<QObject *> *QmlNumericAnimation::exclude()
void QmlNumericAnimationPrivate::valueChanged(qreal r)
{
- if(!fromSourced) {
- if(from.isNull) {
+ if (!fromSourced) {
+ if (from.isNull) {
fromValue = qvariant_cast<qreal>(property.read());
} else {
fromValue = from;
@@ -1584,7 +1584,7 @@ void QmlNumericAnimationPrivate::valueChanged(qreal r)
fromSourced = true;
}
- if(r == 1.) {
+ if (r == 1.) {
property.write(to.value);
} else {
qreal val = fromValue + (to-fromValue) * r;
@@ -1595,7 +1595,7 @@ void QmlNumericAnimationPrivate::valueChanged(qreal r)
void QmlNumericAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlNumericAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -1623,16 +1623,16 @@ void QmlNumericAnimation::transition(QmlStateActions &actions,
void setValue(qreal v)
{
QmlTimeLineValue::setValue(v);
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QmlBehaviour::_ignore = true;
- if(v == 1.)
+ if (v == 1.)
action.property.write(action.toValue.toDouble());
else {
- if(action.fromValue.isNull()) {
+ if (action.fromValue.isNull()) {
action.fromValue = action.property.read();
- if(action.fromValue.isNull()) {
+ if (action.fromValue.isNull()) {
action.fromValue = QVariant(0.);
}
}
@@ -1647,31 +1647,31 @@ void QmlNumericAnimation::transition(QmlStateActions &actions,
};
QStringList props = d->properties.split(QLatin1Char(','));
- for(int ii = 0; ii < props.count(); ++ii)
+ for (int ii = 0; ii < props.count(); ++ii)
props[ii] = props.at(ii).trimmed();
- if(!d->propertyName.isEmpty() && !props.contains(d->propertyName))
+ if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
NTransitionData *data = new NTransitionData;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((d->filter.isEmpty() || d->filter.contains(obj)) &&
+ if ((d->filter.isEmpty() || d->filter.contains(obj)) &&
(!d->exclude.contains(obj)) && props.contains(propertyName) &&
(!target() || target() == obj)) {
objs.insert(obj);
Action myAction = action;
- if(d->from.isValid()) {
+ if (d->from.isValid()) {
myAction.fromValue = QVariant(d->from);
} else {
myAction.fromValue = QVariant();
}
- if(d->to.isValid())
+ if (d->to.isValid())
myAction.toValue = QVariant(d->to);
modified << action.property;
@@ -1681,13 +1681,13 @@ void QmlNumericAnimation::transition(QmlStateActions &actions,
}
}
- if(d->to.isValid() && target() && !objs.contains(target())) {
+ if (d->to.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
- if(d->from.isValid())
+ if (d->from.isValid())
myAction.fromValue = QVariant(d->from);
myAction.toValue = QVariant(d->to);
@@ -1697,7 +1697,7 @@ void QmlNumericAnimation::transition(QmlStateActions &actions,
}
}
- if(data->actions.count()) {
+ if (data->actions.count()) {
d->na->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
} else {
delete data;
@@ -1755,7 +1755,7 @@ QmlSequentialAnimation::~QmlSequentialAnimation()
void QmlSequentialAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlAnimationGroup);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -1778,7 +1778,7 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions,
int inc = 1;
int from = 0;
- if(direction == Backward) {
+ if (direction == Backward) {
inc = -1;
from = d->animations.count() - 1;
}
@@ -1787,7 +1787,7 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions,
for (int i = d->ag->animationCount()-1; i >= 0; --i)
d->ag->takeAnimationAt(i);
- for(int ii = from; ii < d->animations.count() && ii >= 0; ii += inc) {
+ for (int ii = from; ii < d->animations.count() && ii >= 0; ii += inc) {
d->animations.at(ii)->transition(actions, modified, direction);
d->ag->addAnimation(d->animations.at(ii)->qtAnimation());
}
@@ -1805,7 +1805,7 @@ QML_DEFINE_TYPE(QmlSequentialAnimation,SequentialAnimation);
Animations contained in ParallelAnimation will be run at the same time.
- The following animation demonstrates animating the \c MyItem item
+ The following animation demonstrates animating the \c MyItem item
to (100,100) by animating the x and y properties in parallel.
\code
@@ -1846,7 +1846,7 @@ QmlParallelAnimation::~QmlParallelAnimation()
void QmlParallelAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlAnimationGroup);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -1867,7 +1867,7 @@ void QmlParallelAnimation::transition(QmlStateActions &actions,
{
Q_D(QmlAnimationGroup);
- for(int ii = 0; ii < d->animations.count(); ++ii) {
+ for (int ii = 0; ii < d->animations.count(); ++ii) {
d->animations.at(ii)->transition(actions, modified, direction);
}
}
@@ -1976,13 +1976,13 @@ int QmlVariantAnimation::duration() const
void QmlVariantAnimation::setDuration(int duration)
{
- if(duration < 0) {
+ if (duration < 0) {
qWarning("QmlVariantAnimation: Cannot set a duration of < 0");
return;
}
Q_D(QmlVariantAnimation);
- if(d->va->duration() == duration)
+ if (d->va->duration() == duration)
return;
d->va->setDuration(duration);
emit durationChanged(duration);
@@ -2006,7 +2006,7 @@ QVariant QmlVariantAnimation::from() const
void QmlVariantAnimation::setFrom(const QVariant &f)
{
Q_D(QmlVariantAnimation);
- if(!d->from.isNull && f == d->from)
+ if (!d->from.isNull && f == d->from)
return;
d->from = f;
emit fromChanged(f);
@@ -2030,7 +2030,7 @@ QVariant QmlVariantAnimation::to() const
void QmlVariantAnimation::setTo(const QVariant &t)
{
Q_D(QmlVariantAnimation);
- if(!d->to.isNull && t == d->to)
+ if (!d->to.isNull && t == d->to)
return;
d->to = t;
emit toChanged(t);
@@ -2059,7 +2059,7 @@ QString QmlVariantAnimation::easing() const
void QmlVariantAnimation::setEasing(const QString &e)
{
Q_D(QmlVariantAnimation);
- if(d->easing == e)
+ if (d->easing == e)
return;
d->easing = e;
@@ -2090,7 +2090,7 @@ QString QmlVariantAnimation::properties() const
void QmlVariantAnimation::setProperties(const QString &prop)
{
Q_D(QmlVariantAnimation);
- if(d->properties == prop)
+ if (d->properties == prop)
return;
d->properties = prop;
@@ -2121,8 +2121,8 @@ QList<QObject *> *QmlVariantAnimation::exclude()
void QmlVariantAnimationPrivate::valueChanged(qreal r)
{
- if(!fromSourced) {
- if(from.isNull) {
+ if (!fromSourced) {
+ if (from.isNull) {
fromValue = property.read();
} else {
fromValue = from;
@@ -2130,7 +2130,7 @@ void QmlVariantAnimationPrivate::valueChanged(qreal r)
fromSourced = true;
}
- if(r == 1.) {
+ if (r == 1.) {
property.write(to.value);
} else {
QVariant val = interpolateVariant(fromValue, to.value, r);
@@ -2147,7 +2147,7 @@ QAbstractAnimation *QmlVariantAnimation::qtAnimation()
void QmlVariantAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlVariantAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -2174,15 +2174,15 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
void setValue(qreal v)
{
QmlTimeLineValue::setValue(v);
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
- if(v == 1.)
+ if (v == 1.)
action.property.write(action.toValue);
else {
- if(action.fromValue.isNull()) {
+ if (action.fromValue.isNull()) {
action.fromValue = action.property.read();
- /*if(action.fromValue.isNull())
+ /*if (action.fromValue.isNull())
action.fromValue = QVariant(0.);*/ //XXX can we give a default value for any type?
}
QVariant val = QmlVariantAnimationPrivate::interpolateVariant(action.fromValue, action.toValue, v);
@@ -2193,29 +2193,32 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
};
QStringList props = d->properties.split(QLatin1Char(','));
- for(int ii = 0; ii < props.count(); ++ii)
+ for (int ii = 0; ii < props.count(); ++ii)
props[ii] = props.at(ii).trimmed();
- if(!d->propertyName.isEmpty() && !props.contains(d->propertyName))
+ if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
NTransitionData *data = new NTransitionData;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((d->filter.isEmpty() || d->filter.contains(obj)) &&
+ if ((d->filter.isEmpty() || d->filter.contains(obj)) &&
(!d->exclude.contains(obj)) && props.contains(propertyName) &&
(!target() || target() == obj)) {
objs.insert(obj);
Action myAction = action;
- if(d->from.isValid())
+ if (d->from.isValid()) {
myAction.fromValue = QVariant(d->from);
- if(d->to.isValid())
+ } else {
+ myAction.fromValue = QVariant();
+ }
+ if (d->to.isValid())
myAction.toValue = QVariant(d->to);
d->convertVariant(myAction.fromValue, (QVariant::Type)myAction.property.propertyType());
@@ -2228,13 +2231,13 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
}
}
- if(d->to.isValid() && target() && !objs.contains(target())) {
+ if (d->to.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
- if(d->from.isValid()) {
+ if (d->from.isValid()) {
d->convertVariant(d->from.value, (QVariant::Type)myAction.property.propertyType());
myAction.fromValue = QVariant(d->from);
}
@@ -2247,7 +2250,7 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
}
}
- if(data->actions.count()) {
+ if (data->actions.count()) {
d->va->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
} else {
delete data;
@@ -2257,5 +2260,4 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
//XXX whats the best name for this? (just Animation?)
QML_DEFINE_TYPE(QmlVariantAnimation,VariantAnimation);
-
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h
index 80cc7f7..728584c 100644
--- a/src/declarative/util/qmlanimation_p.h
+++ b/src/declarative/util/qmlanimation_p.h
@@ -334,7 +334,7 @@ public:
QmlAnimationGroupPrivate *anim;
};
-
+
AnimationList animations;
QAnimationGroup *ag;
};
diff --git a/src/declarative/util/qmlbehaviour.cpp b/src/declarative/util/qmlbehaviour.cpp
index 3fff06c..58e515f 100644
--- a/src/declarative/util/qmlbehaviour.cpp
+++ b/src/declarative/util/qmlbehaviour.cpp
@@ -182,12 +182,12 @@ bool QmlBehaviour::_ignore = false;
void QmlBehaviour::propertyValueChanged()
{
Q_D(QmlBehaviour);
- if(_ignore)
+ if (_ignore)
return;
QVariant newValue = d->property.read();
- if((!fromValue().isValid() || fromValue() == d->currentValue) &&
+ if ((!fromValue().isValid() || fromValue() == d->currentValue) &&
(!toValue().isValid() || toValue() == newValue)) {
//### does this clean up everything needed?
@@ -208,11 +208,11 @@ void QmlBehaviour::propertyValueChanged()
d->property.write(d->currentValue);
QList<QmlMetaProperty> after;
- for(int ii = 0; ii < d->operations.count(); ++ii) {
+ for (int ii = 0; ii < d->operations.count(); ++ii) {
d->operations.at(ii)->transition(actions, after, QmlAbstractAnimation::Forward);
}
d->group->start();
- if(!after.contains(d->property))
+ if (!after.contains(d->property))
d->property.write(newValue);
_ignore = false;
}
@@ -231,7 +231,7 @@ void QmlBehaviour::setTarget(const QmlMetaProperty &property)
void QmlBehaviour::classBegin()
{
Q_D(QmlBehaviour);
- if(!d->context) {
+ if (!d->context) {
d->context = new QmlContext(qmlContext(this), this);
d->context->addDefaultObject(d->valueData);
}
diff --git a/src/declarative/util/qmlbind.cpp b/src/declarative/util/qmlbind.cpp
index 4451ca2..3b51c6a 100644
--- a/src/declarative/util/qmlbind.cpp
+++ b/src/declarative/util/qmlbind.cpp
@@ -193,7 +193,7 @@ void QmlBind::setValue(const QVariant &v)
void QmlBind::eval()
{
Q_D(QmlBind);
- if(!d->obj || d->value.isNull || !d->when)
+ if (!d->obj || d->value.isNull || !d->when)
return;
QmlMetaProperty prop(d->obj, d->prop);
diff --git a/src/declarative/util/qmlconnection.cpp b/src/declarative/util/qmlconnection.cpp
index 1d3b368..5cd4371 100644
--- a/src/declarative/util/qmlconnection.cpp
+++ b/src/declarative/util/qmlconnection.cpp
@@ -165,7 +165,7 @@ void QmlConnection::connectIfValid()
QList<QByteArray> sigparams;
if (lparen >= 0 && d->signal.length() > lparen+2) {
QStringList l = d->signal.mid(lparen+1,d->signal.length()-lparen-2).split(QLatin1Char(','));
- foreach (QString s, l) {
+ foreach (const QString &s, l) {
sigparams.append(s.toLatin1());
}
}
@@ -173,12 +173,12 @@ void QmlConnection::connectIfValid()
QObject *sender = d->signalSender ? d->signalSender : parent();
const QMetaObject *mo = sender->metaObject();
int methods = mo->methodCount();
- for(int ii = 0; ii < methods; ++ii) {
+ for (int ii = 0; ii < methods; ++ii) {
QMetaMethod method = mo->method(ii);
QString methodName = QLatin1String(method.signature());
int idx = methodName.indexOf(QLatin1Char('('));
methodName = methodName.left(idx);
- if(methodName == signalname && (lparen<0 || method.parameterNames() == sigparams)) {
+ if (methodName == signalname && (lparen<0 || method.parameterNames() == sigparams)) {
sigIdx = ii;
break;
}
diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qmllistaccessor.cpp
index 9387bbc..da54b6e 100644
--- a/src/declarative/util/qmllistaccessor.cpp
+++ b/src/declarative/util/qmllistaccessor.cpp
@@ -64,20 +64,20 @@ void QmlListAccessor::setList(const QVariant &v)
{
d = v;
- if(!d.isValid()) {
+ if (!d.isValid()) {
type = Invalid;
- } else if(d.type() == QVariant::StringList) {
+ } else if (d.type() == QVariant::StringList) {
type = StringList;
- } else if(d.type() != QVariant::UserType) {
+ } else if (d.type() != QVariant::UserType) {
type = Instance;
- } else if(QmlMetaType::isObject(d.userType())) {
+ } else if (QmlMetaType::isObject(d.userType())) {
QObject *data = 0;
data = *(QObject **)v.constData();
d = QVariant::fromValue(data);
type = Instance;
- } else if(QmlMetaType::isQmlList(d.userType())) {
+ } else if (QmlMetaType::isQmlList(d.userType())) {
type = QmlList;
- } else if(QmlMetaType::isList(d.userType())) {
+ } else if (QmlMetaType::isList(d.userType())) {
type = QList;
} else {
type = Invalid;
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index 24f2d5c..54aea2c 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -70,7 +70,7 @@ public:
{
type = QmlListModel::Invalid;
model = QVariant();
- if(listModelInterface)
+ if (listModelInterface)
listModelInterface->disconnect(q);
listModelInterface = 0;
singleObject = 0;
@@ -80,11 +80,11 @@ public:
void updateRoleCache()
{
- if(roleCacheValid)
+ if (roleCacheValid)
return;
roleCacheValid = true;
- if(type == QmlListModel::SingleObject)
+ if (type == QmlListModel::SingleObject)
roleCache = QmlMetaProperty::properties(singleObject);
}
@@ -164,7 +164,7 @@ bool QmlListModel::setModel(const QVariant &model)
d->clear();
QListModelInterface *iface = qvariant_cast<QListModelInterface *>(model);
- if(iface) {
+ if (iface) {
QObject::connect(iface, SIGNAL(itemsInserted(int,int)),
this, SIGNAL(itemsInserted(int,int)));
QObject::connect(iface, SIGNAL(itemsRemoved(int,int)),
@@ -180,14 +180,14 @@ bool QmlListModel::setModel(const QVariant &model)
}
QObject *object = qvariant_cast<QObject *>(model);
- if(object) {
+ if (object) {
d->singleObject = object;
d->type = SingleObject;
d->model = model;
return true;
}
- if(QmlMetaType::isList(model)) {
+ if (QmlMetaType::isList(model)) {
d->type = SimpleList;
d->model = model;
return true;
@@ -214,7 +214,7 @@ QList<int> QmlListModel::roles() const
case SingleObject:
{
QList<int> rv;
- for(int ii = 0; ii < d->roleCache.count(); ++ii)
+ for (int ii = 0; ii < d->roleCache.count(); ++ii)
rv << ii;
return rv;
}
@@ -230,14 +230,14 @@ QString QmlListModel::toString(int role) const
case Invalid:
return QString();
case SimpleList:
- if(role == DATA_ROLE_ID)
+ if (role == DATA_ROLE_ID)
return QLatin1String(DATA_ROLE_NAME);
else
return QString();
case ListInterface:
return d->listModelInterface->toString(role);
case SingleObject:
- if(role >= d->roleCache.count())
+ if (role >= d->roleCache.count())
return QString();
else
return d->roleCache.at(role);
@@ -272,14 +272,14 @@ QHash<int,QVariant> QmlListModel::data(int index, const QList<int> &roles) const
case Invalid:
break;
case SimpleList:
- if(roles.contains(DATA_ROLE_ID))
+ if (roles.contains(DATA_ROLE_ID))
rv.insert(DATA_ROLE_ID, QmlMetaType::listAt(d->model, index));
break;
case ListInterface:
return d->listModelInterface->data(index, roles);
case SingleObject:
{
- for(int ii = 0; ii < roles.count(); ++ii) {
+ for (int ii = 0; ii < roles.count(); ++ii) {
QmlMetaProperty prop(d->singleObject, toString(roles.at(ii)));
rv.insert(roles.at(ii), prop.read());
}
@@ -344,7 +344,7 @@ struct ModelNode
QHash<QString, ModelNode *> properties;
ListModel *model() {
- if(!modelCache) {
+ if (!modelCache) {
modelCache = new ListModel;
modelCache->_root = this;
}
@@ -352,7 +352,7 @@ struct ModelNode
}
ModelObject *object() {
- if(!objectCache) {
+ if (!objectCache) {
objectCache = new ModelObject(this);
QHash<QString, ModelNode *>::iterator it;
for (it = properties.begin(); it != properties.end(); ++it) {
@@ -382,13 +382,13 @@ ListModel::ListModel(QObject *parent)
void ListModel::checkRoles() const
{
- if(_rolesOk)
+ if (_rolesOk)
return;
- for(int ii = 0; ii < _root->values.count(); ++ii) {
+ for (int ii = 0; ii < _root->values.count(); ++ii) {
ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(ii));
- if(node) {
- foreach(QString role, node->properties.keys())
+ if (node) {
+ foreach (const QString &role, node->properties.keys())
addRole(role);
}
}
@@ -398,7 +398,7 @@ void ListModel::checkRoles() const
void ListModel::addRole(const QString &role) const
{
- if(!roleStrings.contains(role))
+ if (!roleStrings.contains(role))
roleStrings << role;
}
@@ -406,7 +406,7 @@ QList<int> ListModel::roles() const
{
checkRoles();
QList<int> rv;
- for(int ii = 0; ii < roleStrings.count(); ++ii)
+ for (int ii = 0; ii < roleStrings.count(); ++ii)
rv << ii;
return rv;
}
@@ -414,7 +414,7 @@ QList<int> ListModel::roles() const
QString ListModel::toString(int role) const
{
checkRoles();
- if(role < roleStrings.count())
+ if (role < roleStrings.count())
return roleStrings.at(role);
else
return QString();
@@ -424,30 +424,30 @@ QVariant ListModel::valueForNode(ModelNode *node) const
{
QObject *rv = 0;
- if(!node->properties.isEmpty()) {
+ if (!node->properties.isEmpty()) {
// Object
rv = node->object();
- } else if(node->values.count() == 0) {
+ } else if (node->values.count() == 0) {
// Invalid
return QVariant();
- } else if(node->values.count() == 1) {
+ } else if (node->values.count() == 1) {
// Value
QVariant &var = node->values[0];
ModelNode *valueNode = qvariant_cast<ModelNode *>(var);
- if(valueNode) {
- if(!valueNode->properties.isEmpty())
+ if (valueNode) {
+ if (!valueNode->properties.isEmpty())
rv = valueNode->object();
else
rv = valueNode->model();
} else {
return var;
}
- } else if(node->values.count() > 1) {
+ } else if (node->values.count() > 1) {
// List
rv = node->model();
}
- if(rv)
+ if (rv)
return QVariant::fromValue(rv);
else
return QVariant();
@@ -457,19 +457,19 @@ QHash<int,QVariant> ListModel::data(int index, const QList<int> &roles) const
{
checkRoles();
QHash<int, QVariant> rv;
- if(index >= count())
+ if (index >= count())
return rv;
ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(index));
- if(!node)
+ if (!node)
return rv;
- for(int ii = 0; ii < roles.count(); ++ii) {
+ for (int ii = 0; ii < roles.count(); ++ii) {
const QString &roleString = roleStrings.at(roles.at(ii));
QHash<QString, ModelNode *>::ConstIterator iter =
node->properties.find(roleString);
- if(iter != node->properties.end()) {
+ if (iter != node->properties.end()) {
ModelNode *row = *iter;
rv.insert(roles.at(ii), valueForNode(row));
}
@@ -480,7 +480,7 @@ QHash<int,QVariant> ListModel::data(int index, const QList<int> &roles) const
int ListModel::count() const
{
- if(!_root) return 0;
+ if (!_root) return 0;
return _root->values.count();
}
@@ -503,9 +503,9 @@ static void dump(ModelNode *node, int ind)
QByteArray indentBa(ind * 4, ' ');
const char *indent = indentBa.constData();
- for(int ii = 0; ii < node->values.count(); ++ii) {
+ for (int ii = 0; ii < node->values.count(); ++ii) {
ModelNode *subNode = qvariant_cast<ModelNode *>(node->values.at(ii));
- if(subNode) {
+ if (subNode) {
qWarning().nospace() << indent << "Sub-node " << ii << ": class " << subNode->className;
dump(subNode, ind + 1);
} else {
@@ -513,7 +513,7 @@ static void dump(ModelNode *node, int ind)
}
}
- for(QHash<QString, ModelNode *>::ConstIterator iter = node->properties.begin(); iter != node->properties.end(); ++iter) {
+ for (QHash<QString, ModelNode *>::ConstIterator iter = node->properties.begin(); iter != node->properties.end(); ++iter) {
qWarning().nospace() << indent << "Property " << iter.key() << ":";
dump(iter.value(), ind + 1);
}
@@ -527,11 +527,11 @@ ModelNode::ModelNode()
ModelNode::~ModelNode()
{
qDeleteAll(properties);
- for(int ii = 0; ii < values.count(); ++ii) {
+ for (int ii = 0; ii < values.count(); ++ii) {
ModelNode *node = qvariant_cast<ModelNode *>(values.at(ii));
- if(node) { delete node; node = 0; }
+ if (node) { delete node; node = 0; }
}
- if(modelCache) { delete modelCache; modelCache = 0; }
+ if (modelCache) { delete modelCache; modelCache = 0; }
}
struct ListModelData
@@ -650,7 +650,7 @@ QByteArray ListModelParser::compile(QXmlStreamReader& reader, bool *ok)
lmd->dataOffset = sizeof(ListModelData) +
instr.count() * sizeof(ListInstruction);
lmd->instrCount = instr.count();
- for(int ii = 0; ii < instr.count(); ++ii)
+ for (int ii = 0; ii < instr.count(); ++ii)
lmd->instructions()[ii] = instr.at(ii);
::memcpy(rv.data() + lmd->dataOffset, data.constData(), data.count());
@@ -668,7 +668,7 @@ QVariant ListModelParser::create(const QByteArray &d)
const ListModelData *lmd = (const ListModelData *)d.constData();
const char *data = ((const char *)lmd) + lmd->dataOffset;
- for(int ii = 0; ii < lmd->instrCount; ++ii) {
+ for (int ii = 0; ii < lmd->instrCount; ++ii) {
const ListInstruction &instr = lmd->instructions()[ii];
switch(instr.type) {
diff --git a/src/declarative/util/qmlopenmetaobject.cpp b/src/declarative/util/qmlopenmetaobject.cpp
index 09d71bd..87d8f4d 100644
--- a/src/declarative/util/qmlopenmetaobject.cpp
+++ b/src/declarative/util/qmlopenmetaobject.cpp
@@ -51,7 +51,7 @@ QmlOpenMetaObject::QmlOpenMetaObject(QObject *obj, bool automatic)
mob.setFlags(QMetaObjectBuilder::DynamicMetaObject);
QObjectPrivate *op = QObjectPrivate::get(obj);
- if(op->metaObject)
+ if (op->metaObject)
mob.setSuperClass(op->metaObject);
mem = mob.toMetaObject();
@@ -63,21 +63,21 @@ QmlOpenMetaObject::QmlOpenMetaObject(QObject *obj, bool automatic)
QmlOpenMetaObject::~QmlOpenMetaObject()
{
- if(parent)
+ if (parent)
delete parent;
qFree(mem);
}
int QmlOpenMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
{
- if(( c == QMetaObject::ReadProperty || c == QMetaObject::WriteProperty)
+ if (( c == QMetaObject::ReadProperty || c == QMetaObject::WriteProperty)
&& id >= _propertyOffset) {
int propId = id - _propertyOffset;
- if(c == QMetaObject::ReadProperty) {
+ if (c == QMetaObject::ReadProperty) {
propertyRead(propId);
*reinterpret_cast<QVariant *>(a[0]) = data[propId];
- } else if(c == QMetaObject::WriteProperty) {
- if(data[propId] != *reinterpret_cast<QVariant *>(a[0])) {
+ } else if (c == QMetaObject::WriteProperty) {
+ if (data[propId] != *reinterpret_cast<QVariant *>(a[0])) {
propertyWrite(propId);
data[propId] = *reinterpret_cast<QVariant *>(a[0]);
activate(_object, _signalOffset + propId, 0);
@@ -85,7 +85,7 @@ int QmlOpenMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
}
return -1;
} else {
- if(parent)
+ if (parent)
return parent->metaCall(c, id, a);
else
return _object->qt_metacall(c, id, a);
@@ -108,7 +108,7 @@ void QmlOpenMetaObject::setValue(int id, const QVariant &value)
QVariant QmlOpenMetaObject::value(const QByteArray &name) const
{
QHash<QByteArray, int>::ConstIterator iter = names.find(name);
- if(iter == names.end())
+ if (iter == names.end())
return QVariant();
return data.at(*iter);
@@ -119,13 +119,13 @@ void QmlOpenMetaObject::setValue(const QByteArray &name, const QVariant &val)
QHash<QByteArray, int>::ConstIterator iter = names.find(name);
int id = -1;
- if(iter == names.end()) {
+ if (iter == names.end()) {
id = doCreateProperty(name.constData()) - _propertyOffset;
} else {
id = *iter;
}
- if(data[id] == val)
+ if (data[id] == val)
return;
data[id] = val;
@@ -134,7 +134,7 @@ void QmlOpenMetaObject::setValue(const QByteArray &name, const QVariant &val)
int QmlOpenMetaObject::createProperty(const char *name, const char *)
{
- if(autoCreate)
+ if (autoCreate)
return doCreateProperty(name);
else
return -1;
diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qmlpackage.cpp
index 264d186..aa7ed38 100644
--- a/src/declarative/util/qmlpackage.cpp
+++ b/src/declarative/util/qmlpackage.cpp
@@ -109,10 +109,10 @@ QmlList<QObject *> *QmlPackage::data()
bool QmlPackage::hasPart(const QString &name)
{
Q_D(QmlPackage);
- for(int ii = 0; ii < d->dataList.count(); ++ii) {
+ for (int ii = 0; ii < d->dataList.count(); ++ii) {
QObject *obj = d->dataList.at(ii);
QmlPackageAttached *a = QmlPackageAttached::attached.value(obj);
- if(a && a->name() == name)
+ if (a && a->name() == name)
return true;
}
return false;
@@ -121,17 +121,17 @@ bool QmlPackage::hasPart(const QString &name)
QObject *QmlPackage::part(const QString &name)
{
Q_D(QmlPackage);
- if(name.isEmpty() && !d->dataList.isEmpty())
+ if (name.isEmpty() && !d->dataList.isEmpty())
return d->dataList.at(0);
- for(int ii = 0; ii < d->dataList.count(); ++ii) {
+ for (int ii = 0; ii < d->dataList.count(); ++ii) {
QObject *obj = d->dataList.at(ii);
QmlPackageAttached *a = QmlPackageAttached::attached.value(obj);
- if(a && a->name() == name)
+ if (a && a->name() == name)
return obj;
}
- if(name == QLatin1String("default") && !d->dataList.isEmpty())
+ if (name == QLatin1String("default") && !d->dataList.isEmpty())
return d->dataList.at(0);
return 0;
diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp
index 73c8c07..fbaf56e 100644
--- a/src/declarative/util/qmlscript.cpp
+++ b/src/declarative/util/qmlscript.cpp
@@ -194,7 +194,7 @@ void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &f
if (scriptEngine->hasUncaughtException()) {
if (scriptEngine->uncaughtException().isError()){
QScriptValue exception = scriptEngine->uncaughtException();
- if(!exception.property(QLatin1String("fileName")).toString().isEmpty()){
+ if (!exception.property(QLatin1String("fileName")).toString().isEmpty()){
qWarning() << exception.property(QLatin1String("fileName")).toString()
<< scriptEngine->uncaughtExceptionLineNumber()
<< exception.toString();
diff --git a/src/declarative/util/qmlscript.h b/src/declarative/util/qmlscript.h
index fc038b4..8047a88 100644
--- a/src/declarative/util/qmlscript.h
+++ b/src/declarative/util/qmlscript.h
@@ -58,7 +58,7 @@ class Q_DECLARATIVE_EXPORT QmlScript : public QObject
Q_DECLARE_PRIVATE(QmlScript);
Q_PROPERTY(QString script READ script WRITE setScript);
- Q_PROPERTY(QString src READ source WRITE setSource);
+ Q_PROPERTY(QString source READ source WRITE setSource);
Q_CLASSINFO("DefaultProperty", "script");
public:
diff --git a/src/declarative/util/qmlsetproperties.cpp b/src/declarative/util/qmlsetproperties.cpp
index 61890b9..108f2b2 100644
--- a/src/declarative/util/qmlsetproperties.cpp
+++ b/src/declarative/util/qmlsetproperties.cpp
@@ -80,7 +80,7 @@ QmlSetPropertiesMetaObject::QmlSetPropertiesMetaObject(QObject *obj)
void QmlSetPropertiesMetaObject::propertyRead(int id)
{
- if(!value(id).isValid())
+ if (!value(id).isValid())
setValue(id, QVariant::fromValue((QObject *)new QmlSetPropertiesProxyObject(object())));
QmlOpenMetaObject::propertyRead(id);
@@ -88,10 +88,10 @@ void QmlSetPropertiesMetaObject::propertyRead(int id)
void QmlSetPropertiesMetaObject::propertyWrite(int id)
{
- if(value(id).userType() == qMetaTypeId<QObject *>()) {
+ if (value(id).userType() == qMetaTypeId<QObject *>()) {
QObject *val = qvariant_cast<QObject *>(value(id));
QmlSetPropertiesProxyObject *proxy = qobject_cast<QmlSetPropertiesProxyObject *>(val);
- if(proxy) {
+ if (proxy) {
setValue(id, QVariant());
delete proxy;
}
@@ -203,9 +203,9 @@ QmlSetProperties::doAction(QmlSetPropertiesMetaObject *metaObject,
QmlMetaProperty prop(object, QLatin1String(name));
- if(po) {
+ if (po) {
QObject *objVal = QmlMetaType::toQObject(prop.read());
- if(!objVal) {
+ if (!objVal) {
qmlInfo(this) << object->metaObject()->className()
<< "has no object property named" << name;
continue;
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index 6a9cc12..cd33f5e 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -170,7 +170,7 @@ void QmlState::setWhen(QmlBindableValue *when)
{
Q_D(QmlState);
d->when = when;
- if(d->group)
+ if (d->group)
d->group->updateAutoState();
}
@@ -237,10 +237,10 @@ QmlState &QmlState::operator<<(QmlStateOperation *op)
#if 0
static void dump(const QmlStateOperation::ActionList &list)
{
- if(!QString(getenv("STATE_DEBUG")).isEmpty())
+ if (!QString(getenv("STATE_DEBUG")).isEmpty())
return;
- for(int ii = 0; ii < list.count(); ++ii) {
+ for (int ii = 0; ii < list.count(); ++ii) {
const Action &action = list.at(ii);
qWarning() << action.property.object << action.property.name << action.toValue;
}
@@ -259,9 +259,9 @@ void QmlStatePrivate::complete()
}
//////////////////////////////////////////////////////////
- for(int ii = 0; ii < reverting.count(); ++ii) {
- for(int jj = 0; jj < revertList.count(); ++jj) {
- if(revertList.at(jj).property == reverting.at(ii)) {
+ for (int ii = 0; ii < reverting.count(); ++ii) {
+ for (int jj = 0; jj < revertList.count(); ++jj) {
+ if (revertList.at(jj).property == reverting.at(ii)) {
revertList.removeAt(jj);
break;
}
@@ -269,7 +269,7 @@ void QmlStatePrivate::complete()
}
reverting.clear();
- for(int ii = 0; ii < completeList.count(); ++ii) {
+ for (int ii = 0; ii < completeList.count(); ++ii) {
const QmlMetaProperty &prop = completeList.at(ii).property;
prop.write(completeList.at(ii).value);
}
@@ -282,15 +282,15 @@ void QmlStatePrivate::complete()
QmlStateOperation::ActionList QmlStatePrivate::generateActionList(QmlStateGroup *group) const
{
QmlStateOperation::ActionList applyList;
- if(inState)
+ if (inState)
return applyList;
inState = true;
- if(!extends.isEmpty()) {
+ if (!extends.isEmpty()) {
QList<QmlState *> states = group->states();
- for(int ii = 0; ii < states.count(); ++ii)
- if(states.at(ii)->name() == extends)
+ for (int ii = 0; ii < states.count(); ++ii)
+ if (states.at(ii)->name() == extends)
applyList = static_cast<QmlStatePrivate*>(states.at(ii)->d_ptr)->generateActionList(group);
}
@@ -327,41 +327,41 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
Q_D(QmlState);
cancel();
- if(revert)
+ if (revert)
revert->cancel();
d->revertList.clear();
d->reverting.clear();
d->bindingsList.clear();
- if(revert)
+ if (revert)
d->revertList = static_cast<QmlStatePrivate*>(revert->d_ptr)->revertList;
QmlStateOperation::RevertActionList additionalReverts;
QmlStateOperation::ActionList applyList = d->generateActionList(group);
- for(int ii = 0; ii < applyList.count(); ++ii) {
+ for (int ii = 0; ii < applyList.count(); ++ii) {
const Action &action = applyList.at(ii);
- if(action.event)
+ if (action.event)
continue;
bool found = false;
- for(int jj = 0; !found && jj < d->revertList.count(); ++jj) {
- if(d->revertList.at(jj).property == action.property)
+ for (int jj = 0; !found && jj < d->revertList.count(); ++jj) {
+ if (d->revertList.at(jj).property == action.property)
found = true;
}
- if(!found) {
+ if (!found) {
RevertAction r(action);
additionalReverts << r;
}
}
- for(int ii = 0; ii < d->revertList.count(); ++ii) {
+ for (int ii = 0; ii < d->revertList.count(); ++ii) {
bool found = false;
- for(int jj = 0; !found && jj < applyList.count(); ++jj) {
+ for (int jj = 0; !found && jj < applyList.count(); ++jj) {
const Action &action = applyList.at(jj);
- if(action.property == d->revertList.at(ii).property)
+ if (action.property == d->revertList.at(ii).property)
found = true;
}
- if(!found) {
+ if (!found) {
QVariant cur = d->revertList.at(ii).property.read();
Action a;
a.property = d->revertList.at(ii).property;
@@ -383,7 +383,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
//### 4 foreach loops!
////////////////////////////////////////////////////////////////////
foreach(const Action &action, applyList) {
- if(stateChangeDebug())
+ if (stateChangeDebug())
qWarning() << " Action:" << action.property.object() << action.property.name() << action.toValue;
if (action.bv && !action.toBinding.isEmpty()) {
@@ -396,14 +396,14 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
foreach(const Action &action, applyList) {
if (action.bv && !action.toBinding.isEmpty()) {
action.bv->setExpression(action.toBinding);
- } else if(!action.event) {
+ } else if (!action.event) {
action.property.write(action.toValue);
}
}
for (int ii = 0; ii < applyList.size(); ++ii) {
Action *action = &applyList[ii];
- if(action->event)
+ if (action->event)
continue;
const QmlMetaProperty &prop = action->property;
@@ -413,7 +413,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
}
foreach(const Action &action, applyList) {
- if(action.event)
+ if (action.event)
continue;
if (action.bv && !action.toBinding.isEmpty())
@@ -426,23 +426,23 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
QmlStateOperation::ActionList modList = applyList;
QList<QmlMetaProperty> touched;
d->completeList.clear();
- if(trans) {
+ if (trans) {
d->transition = trans;
trans->prepare(modList, touched, this);
- for(int ii = 0; ii < modList.count(); ++ii) {
+ for (int ii = 0; ii < modList.count(); ++ii) {
const Action &action = modList.at(ii);
- if(action.event) {
- if(action.actionDone) {
+ if (action.event) {
+ if (action.actionDone) {
modList.removeAt(ii);
--ii;
}
} else {
- if(action.toValue != action.fromValue) {
+ if (action.toValue != action.fromValue) {
d->completeList << RevertAction(action, false);
}
- if(touched.contains(action.property)) {
+ if (touched.contains(action.property)) {
modList.removeAt(ii);
--ii;
}
@@ -451,7 +451,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
}
foreach(const Action &action, modList) {
- if(action.event)
+ if (action.event)
action.event->execute();
else
action.property.write(action.toValue);
diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp
index 36fea4e..cabef63 100644
--- a/src/declarative/util/qmlstategroup.cpp
+++ b/src/declarative/util/qmlstategroup.cpp
@@ -68,7 +68,7 @@ public:
:group(g) {}
void append(QmlState *s) {
QmlConcreteList<QmlState *>::append(s);
- if(s) s->setStateGroup(group);
+ if (s) s->setStateGroup(group);
}
private:
QmlStateGroup *group;
@@ -121,7 +121,7 @@ QString QmlStateGroup::state() const
void QmlStateGroup::setState(const QString &state)
{
Q_D(QmlStateGroup);
- if(d->currentState == state)
+ if (d->currentState == state)
return;
d->setCurrentStateInternal(state);
@@ -152,27 +152,27 @@ void QmlStateGroup::updateAutoState()
void QmlStateGroupPrivate::updateAutoState()
{
Q_Q(QmlStateGroup);
- if(!classComplete)
+ if (!classComplete)
return;
bool revert = false;
- for(int ii = 0; ii < states.count(); ++ii) {
+ for (int ii = 0; ii < states.count(); ++ii) {
QmlState *state = states.at(ii);
- if(state->isWhenKnown()) {
- if(!state->name().isEmpty()) {
- if(state->when() && state->when()->value().toBool()) {
- if(stateChangeDebug())
+ if (state->isWhenKnown()) {
+ if (!state->name().isEmpty()) {
+ if (state->when() && state->when()->value().toBool()) {
+ if (stateChangeDebug())
qWarning() << "Setting auto state due to:"
<< state->when()->expression();
q->setState(state->name());
return;
- } else if(state->name() == currentState) {
+ } else if (state->name() == currentState) {
revert = true;
}
}
}
}
- if(revert)
+ if (revert)
q->setState(QString());
}
@@ -183,11 +183,11 @@ QmlTransition *QmlStateGroupPrivate::findTransition(const QString &from, const Q
bool reversed = false;
bool done = false;
- for(int ii = 0; !done && ii < transitions.count(); ++ii) {
+ for (int ii = 0; !done && ii < transitions.count(); ++ii) {
QmlTransition *t = transitions.at(ii);
- for(int ii = 0; ii < 2; ++ii)
+ for (int ii = 0; ii < 2; ++ii)
{
- if(ii && (!t->reversible() ||
+ if (ii && (!t->reversible() ||
(t->fromState() == QLatin1String("*") &&
t->toState() == QLatin1String("*"))))
break;
@@ -196,40 +196,40 @@ QmlTransition *QmlStateGroupPrivate::findTransition(const QString &from, const Q
fromState = t->fromState().split(QLatin1Char(','));
toState = t->toState().split(QLatin1Char(','));
- if(ii == 1)
+ if (ii == 1)
qSwap(fromState, toState);
int tScore = 0;
- if(fromState.contains(from))
+ if (fromState.contains(from))
tScore += 2;
- else if(fromState.contains(QLatin1String("*")))
+ else if (fromState.contains(QLatin1String("*")))
tScore += 1;
else
continue;
- if(toState.contains(to))
+ if (toState.contains(to))
tScore += 2;
- else if(toState.contains(QLatin1String("*")))
+ else if (toState.contains(QLatin1String("*")))
tScore += 1;
else
continue;
- if(ii == 1)
+ if (ii == 1)
reversed = true;
else
reversed = false;
- if(tScore == 4) {
+ if (tScore == 4) {
highest = t;
done = true;
break;
- } else if(tScore > score) {
+ } else if (tScore > score) {
score = tScore;
highest = t;
}
}
}
- if(highest)
+ if (highest)
highest->setReversed(reversed);
return highest;
@@ -239,21 +239,21 @@ void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state,
bool ignoreTrans)
{
Q_Q(QmlStateGroup);
- if(!componentComplete)
+ if (!componentComplete)
return;
QmlTransition *transition = (ignoreTrans || ignoreTrans) ? 0 : findTransition(currentState, state);
- if(stateChangeDebug()) {
+ if (stateChangeDebug()) {
qWarning() << this << "Changing state. From" << currentState << ". To" << state;
- if(transition)
+ if (transition)
qWarning() << " using transition" << transition->fromState()
<< transition->toState();
}
QmlState *oldState = 0;
- if(!currentState.isEmpty()) {
- for(int ii = 0; ii < states.count(); ++ii) {
- if(states.at(ii)->name() == currentState) {
+ if (!currentState.isEmpty()) {
+ for (int ii = 0; ii < states.count(); ++ii) {
+ if (states.at(ii)->name() == currentState) {
oldState = states.at(ii);
break;
}
@@ -263,17 +263,17 @@ void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state,
currentState = state;
QmlState *newState = 0;
- for(int ii = 0; ii < states.count(); ++ii) {
- if(states.at(ii)->name() == currentState) {
+ for (int ii = 0; ii < states.count(); ++ii) {
+ if (states.at(ii)->name() == currentState) {
newState = states.at(ii);
break;
}
}
- if(oldState == 0 || newState == 0) {
- if(!nullState) { nullState = new QmlState(q); }
- if(!oldState) oldState = nullState;
- if(!newState) newState = nullState;
+ if (oldState == 0 || newState == 0) {
+ if (!nullState) { nullState = new QmlState(q); }
+ if (!oldState) oldState = nullState;
+ if (!newState) newState = nullState;
}
newState->apply(q, transition, oldState);
@@ -284,7 +284,7 @@ void QmlStateGroup::componentComplete()
Q_D(QmlStateGroup);
d->updateAutoState();
d->componentComplete = true;
- if(!d->currentState.isEmpty()) {
+ if (!d->currentState.isEmpty()) {
QString cs = d->currentState;
d->currentState = QString();
d->setCurrentStateInternal(cs, true);
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index c70977a..8a10ca3 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -109,7 +109,7 @@ void QmlParentChange::setParent(QObject *parent)
QmlStateOperation::ActionList QmlParentChange::actions()
{
Q_D(QmlParentChange);
- if(!d->target || !d->parent)
+ if (!d->target || !d->parent)
return ActionList();
QString propName(QLatin1String("moveToParent"));
@@ -118,7 +118,7 @@ QmlStateOperation::ActionList QmlParentChange::actions()
qmlInfo(this) << d->target->metaObject()->className()
<< "has no property named" << propName;
return ActionList();
- }else if(!prop.isWritable()){
+ }else if (!prop.isWritable()){
qmlInfo(this) << d->target->metaObject()->className() << propName
<< "is not a writable property and cannot be set.";
return ActionList();
@@ -187,7 +187,7 @@ void QmlRunScript::setName(const QString &n)
void QmlRunScript::execute()
{
Q_D(QmlRunScript);
- if(!d->script.isEmpty()) {
+ if (!d->script.isEmpty()) {
QmlExpression expr(qmlContext(this), d->script, this);
expr.setTrackChange(false);
expr.value();
@@ -354,7 +354,7 @@ void QmlSetProperty::setBinding(const QString &binding)
QmlSetProperty::ActionList QmlSetProperty::actions()
{
Q_D(QmlSetProperty);
- if(!d->obj)
+ if (!d->obj)
return ActionList();
QObject *obj = d->obj;
@@ -362,10 +362,10 @@ QmlSetProperty::ActionList QmlSetProperty::actions()
if (d->prop.contains(QLatin1Char('.'))) { //handle dot properties
QStringList str = d->prop.split(QLatin1Char('.'));
- for(int ii = 0; ii < str.count()-1; ++ii) {
+ for (int ii = 0; ii < str.count()-1; ++ii) {
const QString &s = str.at(ii);
QmlMetaProperty prop(obj, s);
- if(!prop.isValid()) {
+ if (!prop.isValid()) {
qmlInfo(this) << obj->metaObject()->className()
<< "has no property named" << s;
return ActionList();
@@ -386,7 +386,7 @@ QmlSetProperty::ActionList QmlSetProperty::actions()
qmlInfo(this) << obj->metaObject()->className()
<< "has no property named" << propName;
return ActionList();
- }else if(!prop.isWritable()){
+ }else if (!prop.isWritable()){
qmlInfo(this) << obj->metaObject()->className() << propName
<< "is not a writable property and cannot be set.";
return ActionList();
@@ -399,7 +399,7 @@ QmlSetProperty::ActionList QmlSetProperty::actions()
a.toValue = d->value;
if (!d->binding.isEmpty()) {
QmlBindableValue *bv = prop.binding();
- if(bv) {
+ if (bv) {
a.fromBinding = bv->expression();
a.bv = bv;
}
diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp
index 181fdb9..a515f58 100644
--- a/src/declarative/util/qmltransition.cpp
+++ b/src/declarative/util/qmltransition.cpp
@@ -165,12 +165,12 @@ void QmlTransition::prepare(QmlStateOperation::ActionList &actions,
{
Q_D(QmlTransition);
- if(d->reversed) {
- for(int ii = d->operations.count() - 1; ii >= 0; --ii) {
+ if (d->reversed) {
+ for (int ii = d->operations.count() - 1; ii >= 0; --ii) {
d->operations.at(ii)->transition(actions, after, QmlAbstractAnimation::Backward);
}
} else {
- for(int ii = 0; ii < d->operations.count(); ++ii) {
+ for (int ii = 0; ii < d->operations.count(); ++ii) {
d->operations.at(ii)->transition(actions, after, QmlAbstractAnimation::Forward);
}
}
diff --git a/src/declarative/util/qperformancelog.cpp b/src/declarative/util/qperformancelog.cpp
index 52ccc0d..8065f9d 100644
--- a/src/declarative/util/qperformancelog.cpp
+++ b/src/declarative/util/qperformancelog.cpp
@@ -77,22 +77,22 @@ QPerformanceLog::LogData::LogData(const char *desc)
QPerformanceLog::LogMetric::LogMetric(LogData *l, int id, const char *desc)
{
- if(id < 0)
+ if (id < 0)
qFatal("QPerformanceLog: Invalid log id %d ('%s')", id, desc);
QPerformanceLogData *logData = performanceLogData();
QPerformanceLogData::Logs::Iterator logIter = logData->logs.find(l);
- if(logIter == logData->logs.end())
+ if (logIter == logData->logs.end())
qFatal("QPerformanceLog: Unable to locate log for metric '%s'", desc);
QPerformanceLogData::Log &log = *logIter;
- if(log.descriptions.contains(id))
+ if (log.descriptions.contains(id))
qFatal("QPerformanceLog: Duplicate log metric %d ('%s')", id, desc);
log.descriptions.insert(id, desc);
- if(log.maxId < id) {
+ if (log.maxId < id) {
log.maxId = id;
- if(l->data) delete [] l->data;
+ if (l->data) delete [] l->data;
l->data = new unsigned int[2 * (log.maxId + 1)];
::memset(l->data, 0, 2 * (log.maxId + 1) * sizeof(unsigned int));
}
@@ -107,7 +107,7 @@ static void QPerformanceLog_displayData(const QPerformanceLog::LogData *l, const
{
qWarning() << pl->logDescription << "performance data";
unsigned int total = 0;
- for(QHash<int, const char *>::ConstIterator iter = pl->descriptions.begin();
+ for (QHash<int, const char *>::ConstIterator iter = pl->descriptions.begin();
iter != pl->descriptions.end();
++iter) {
@@ -126,7 +126,7 @@ void QPerformanceLog::displayData()
{
QPerformanceLogData *logData = performanceLogData();
- for(QPerformanceLogData::Logs::ConstIterator iter = logData->logs.begin();
+ for (QPerformanceLogData::Logs::ConstIterator iter = logData->logs.begin();
iter != logData->logs.end();
++iter) {
QPerformanceLog_displayData(iter.key(), &(*iter));
@@ -137,7 +137,7 @@ void QPerformanceLog::clear()
{
QPerformanceLogData *logData = performanceLogData();
- for(QPerformanceLogData::Logs::ConstIterator iter = logData->logs.begin();
+ for (QPerformanceLogData::Logs::ConstIterator iter = logData->logs.begin();
iter != logData->logs.end();
++iter) {
QPerformanceLog_clear(iter.key(), &(*iter));
@@ -148,7 +148,7 @@ void QPerformanceLog::displayData(LogData *l)
{
QPerformanceLogData *logData = performanceLogData();
QPerformanceLogData::Logs::ConstIterator iter = logData->logs.find(l);
- if(iter == logData->logs.end())
+ if (iter == logData->logs.end())
qFatal("QPerformanceLog: Internal corruption - unable to locate log");
QPerformanceLog_displayData(iter.key(), &(*iter));
@@ -158,7 +158,7 @@ void QPerformanceLog::clear(LogData *l)
{
QPerformanceLogData *logData = performanceLogData();
QPerformanceLogData::Logs::ConstIterator iter = logData->logs.find(l);
- if(iter == logData->logs.end())
+ if (iter == logData->logs.end())
qFatal("QPerformanceLog: Internal corruption - unable to locate log");
QPerformanceLog_clear(iter.key(), &(*iter));