summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-08-11 11:50:37 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-08-11 11:50:37 (GMT)
commitc6ed32dc7e9c8a566f376d1baa7e616a1019f9af (patch)
tree95ce43172963aa266630d8836ccb6b23dde78991 /src/declarative
parent9986c3f0c0681c7ea8bc8e5cfea5662880db6654 (diff)
parent5fa15620d09df1164cc28aa9b1e646a61f87e909 (diff)
downloadQt-c6ed32dc7e9c8a566f376d1baa7e616a1019f9af.zip
Qt-c6ed32dc7e9c8a566f376d1baa7e616a1019f9af.tar.gz
Qt-c6ed32dc7e9c8a566f376d1baa7e616a1019f9af.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflipable.cpp14
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp30
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecompiledbindings.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp15
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp4
-rw-r--r--src/declarative/qml/qdeclarativeexpression.cpp4
-rw-r--r--src/declarative/qml/qdeclarativeimageprovider.cpp4
-rw-r--r--src/declarative/qml/qdeclarativeinfo.cpp1
-rw-r--r--src/declarative/qml/qdeclarativeinstruction.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeprivate.h2
-rw-r--r--src/declarative/qml/qdeclarativeproperty.cpp2
-rw-r--r--src/declarative/qml/qdeclarativescriptparser.cpp2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp52
-rw-r--r--src/declarative/util/qdeclarativebehavior.cpp9
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp38
-rw-r--r--src/declarative/util/qdeclarativelistmodel_p_p.h3
-rw-r--r--src/declarative/util/qdeclarativepropertymap.cpp19
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation.cpp2
-rw-r--r--src/declarative/util/qdeclarativespringanimation.cpp3
-rw-r--r--src/declarative/util/qdeclarativestate.cpp5
-rw-r--r--src/declarative/util/qdeclarativestategroup.cpp4
-rw-r--r--src/declarative/util/qdeclarativetransition.cpp21
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp8
25 files changed, 153 insertions, 97 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
index 8c9d2dd..b266273 100644
--- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
@@ -83,10 +83,16 @@ public:
\image flipable.gif
- The \l Rotation element is used to specify the angle and axis of the flip,
- and the \l State defines the changes in angle which produce the flipping
- effect. Finally, the \l Transition creates the animation that changes the
- angle over one second.
+ The \l Rotation element is used to specify the angle and axis of the flip.
+ When \c flipped is \c true, the item changes to the "back" state, where
+ the angle is changed to 180 degrees to produce the flipping effect.
+ Finally, the \l Transition creates the animation that changes the
+ angle over one second: when the item changes between its "back" and
+ default states, the NumberAnimation animates the angle between
+ its old and new values.
+
+ See the \l {QML States} and \l {QML Animation} documentation for more
+ details on state changes and how animations work within transitions.
\sa {declarative/ui-components/flipable}{Flipable example}
*/
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 50998eb..2b41710 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -2406,18 +2406,7 @@ void QDeclarativeItemPrivate::focusChanged(bool flag)
Q_Q(QDeclarativeItem);
if (!(flags & QGraphicsItem::ItemIsFocusScope) && parent)
emit q->activeFocusChanged(flag); //see also QDeclarativeItemPrivate::subFocusItemChange()
-
- bool inScope = false;
- QGraphicsItem *p = parent;
- while (p) {
- if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
- inScope = true;
- break;
- }
- p = p->parentItem();
- }
- if (!inScope)
- emit q->focusChanged(flag);
+ emit q->focusChanged(flag);
}
/*! \internal */
@@ -2465,7 +2454,7 @@ QDeclarativeListProperty<QDeclarativeState> QDeclarativeItemPrivate::states()
}
\endqml
- \sa {state-transitions}{Transitions}
+ \sa {qdeclarativeanimation.html#transitions}{QML Transitions}
*/
@@ -2735,12 +2724,12 @@ QVariant QDeclarativeItem::itemChange(GraphicsItemChange change,
}
break;
case ItemChildAddedChange:
- if (d->_contents)
+ if (d->_contents && d->componentComplete)
d->_contents->childAdded(qobject_cast<QDeclarativeItem*>(
value.value<QGraphicsItem*>()));
break;
case ItemChildRemovedChange:
- if (d->_contents)
+ if (d->_contents && d->componentComplete)
d->_contents->childRemoved(qobject_cast<QDeclarativeItem*>(
value.value<QGraphicsItem*>()));
break;
@@ -3207,8 +3196,7 @@ bool QDeclarativeItem::hasActiveFocus() const
{
Q_D(const QDeclarativeItem);
return focusItem() == this ||
- (d->flags & QGraphicsItem::ItemIsFocusScope && focusItem() != 0) ||
- (!parentItem() && focusItem() != 0);
+ (d->flags & QGraphicsItem::ItemIsFocusScope && focusItem() != 0);
}
/*!
@@ -3228,10 +3216,8 @@ bool QDeclarativeItem::hasActiveFocus() const
}
\endqml
- For the purposes of this property, the top level item in the scene
- is assumed to act like a focus scope, and to always have active focus
- when the scene has focus. On a practical level, that means the following
- QML will give active focus to \c input on startup.
+ For the purposes of this property, the scene as a whole is assumed to act like a focus scope.
+ On a practical level, that means the following QML will give active focus to \c input on startup.
\qml
Rectangle {
@@ -3257,7 +3243,7 @@ bool QDeclarativeItem::hasFocus() const
p = p->parentItem();
}
- return hasActiveFocus() ? true : (!QGraphicsItem::parentItem() ? true : false);
+ return hasActiveFocus();
}
/*! \internal */
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 06ac275..5771f84 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -1061,7 +1061,7 @@ void QDeclarativePathView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if (!d->stealMouse) {
QPointF delta = event->pos() - d->startPoint;
- if (qAbs(delta.x()) > QApplication::startDragDistance() && qAbs(delta.y()) > QApplication::startDragDistance())
+ if (qAbs(delta.x()) > QApplication::startDragDistance() || qAbs(delta.y()) > QApplication::startDragDistance())
d->stealMouse = true;
}
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index ceb1961..a489b5a 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -525,7 +525,7 @@ QVariant QDeclarativeVisualDataModelDataMetaObject::initialValue(int propId)
QVariant value = model->m_listModelInterface->data(data->m_index, *it);
return value;
} else if (model->m_roles.count() == 1 && propName == "modelData") {
- //for compatability with other lists, assign modelData if there is only a single role
+ //for compatibility with other lists, assign modelData if there is only a single role
QVariant value = model->m_listModelInterface->data(data->m_index, model->m_roles.first());
return value;
}
diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp
index 507e47b..723da94 100644
--- a/src/declarative/qml/qdeclarativecompiledbindings.cpp
+++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp
@@ -1628,7 +1628,7 @@ void QDeclarativeBindingCompiler::dump(const QByteArray &programData)
/*!
Clear the state associated with attempting to compile a specific binding.
-This does not clear the global "commited binding" states.
+This does not clear the global "committed binding" states.
*/
void QDeclarativeBindingCompilerPrivate::resetInstanceState()
{
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index ba757fc..2b4a4a5 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -2215,10 +2215,11 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj)
if (propNames.contains(prop.name))
COMPILE_EXCEPTION(&prop, tr("Duplicate property name"));
- if (QString::fromUtf8(prop.name).at(0).isUpper())
+ QString propName = QString::fromUtf8(prop.name);
+ if (propName.at(0).isUpper())
COMPILE_EXCEPTION(&prop, tr("Property names cannot begin with an upper case letter"));
- if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(prop.name))
+ if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(propName))
COMPILE_EXCEPTION(&prop, tr("Illegal property name"));
propNames.insert(prop.name);
@@ -2228,9 +2229,10 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj)
QByteArray name = obj->dynamicSignals.at(ii).name;
if (methodNames.contains(name))
COMPILE_EXCEPTION(obj, tr("Duplicate signal name"));
- if (QString::fromUtf8(name).at(0).isUpper())
+ QString nameStr = QString::fromUtf8(name);
+ if (nameStr.at(0).isUpper())
COMPILE_EXCEPTION(obj, tr("Signal names cannot begin with an upper case letter"));
- if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(name))
+ if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(nameStr))
COMPILE_EXCEPTION(obj, tr("Illegal signal name"));
methodNames.insert(name);
}
@@ -2238,9 +2240,10 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj)
QByteArray name = obj->dynamicSlots.at(ii).name;
if (methodNames.contains(name))
COMPILE_EXCEPTION(obj, tr("Duplicate method name"));
- if (QString::fromUtf8(name).at(0).isUpper())
+ QString nameStr = QString::fromUtf8(name);
+ if (nameStr.at(0).isUpper())
COMPILE_EXCEPTION(obj, tr("Method names cannot begin with an upper case letter"));
- if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(name))
+ if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(nameStr))
COMPILE_EXCEPTION(obj, tr("Illegal method name"));
methodNames.insert(name);
}
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 1d48b1a..5f4a063 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -192,7 +192,7 @@ class QByteArray;
\value Null This QDeclarativeComponent has no data. Call loadUrl() or setData() to add QML content.
\value Ready This QDeclarativeComponent is ready and create() may be called.
\value Loading This QDeclarativeComponent is loading network data.
- \value Error An error has occured. Call errors() to retrieve a list of \{QDeclarativeError}{errors}.
+ \value Error An error has occurred. Call errors() to retrieve a list of \{QDeclarativeError}{errors}.
*/
void QDeclarativeComponentPrivate::typeDataReady()
@@ -518,7 +518,7 @@ void QDeclarativeComponent::loadUrl(const QUrl &url)
}
/*!
- Return the list of errors that occured during the last compile or create
+ Return the list of errors that occurred during the last compile or create
operation. An empty list is returned if isError() is not set.
*/
QList<QDeclarativeError> QDeclarativeComponent::errors() const
diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp
index 585fb69..6fc4df0 100644
--- a/src/declarative/qml/qdeclarativeexpression.cpp
+++ b/src/declarative/qml/qdeclarativeexpression.cpp
@@ -143,16 +143,12 @@ void QDeclarativeExpressionPrivate::init(QDeclarativeContextData *ctxt, void *ex
} else {
-#if !defined(Q_OS_SYMBIAN) //XXX Why doesn't this work?
if (!dd->cachedPrograms.at(progIdx)) {
dd->cachedPrograms[progIdx] = new QScriptProgram(expression, url, line);
}
expressionFunction = evalInObjectScope(ctxt, me, *dd->cachedPrograms.at(progIdx),
&expressionContext);
-#else
- expressionFunction = evalInObjectScope(ctxt, me, expression, &expressionContext);
-#endif
expressionFunctionMode = ExplicitContext;
expressionFunctionValid = true;
diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp
index 241df87..340bfa7 100644
--- a/src/declarative/qml/qdeclarativeimageprovider.cpp
+++ b/src/declarative/qml/qdeclarativeimageprovider.cpp
@@ -59,7 +59,7 @@ public:
\list
\o Loaded using QPixmaps rather than actual image files
- \o Loaded asynchronously in a separate thread, if imageType() is \l ImageType::Image
+ \o Loaded asynchronously in a separate thread, if imageType() is \l Image
\endlist
To specify that an image should be loaded by an image provider, use the
@@ -112,7 +112,7 @@ public:
}
\endcode
- Now the images can be succesfully loaded in QML:
+ Now the images can be successfully loaded in QML:
\image imageprovider.png
diff --git a/src/declarative/qml/qdeclarativeinfo.cpp b/src/declarative/qml/qdeclarativeinfo.cpp
index c980a2a..c6560dd 100644
--- a/src/declarative/qml/qdeclarativeinfo.cpp
+++ b/src/declarative/qml/qdeclarativeinfo.cpp
@@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn QDeclarativeInfo qmlInfo(const QObject *object)
+ \relates QDeclarativeEngine
\brief Prints warnings messages that include the file and line number for QML types.
diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp
index 0f7b09d..1767d2f 100644
--- a/src/declarative/qml/qdeclarativeinstruction.cpp
+++ b/src/declarative/qml/qdeclarativeinstruction.cpp
@@ -218,7 +218,7 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
qWarning().nospace() << idx << "\t\t" << line << "\t" << "DEFER" << "\t\t\t" << instr->defer.deferCount;
break;
default:
- qWarning().nospace() << idx << "\t\t" << line << "\t" << "XXX UNKOWN INSTRUCTION" << "\t" << instr->type;
+ qWarning().nospace() << idx << "\t\t" << line << "\t" << "XXX UNKNOWN INSTRUCTION" << "\t" << instr->type;
break;
}
#endif // QT_NO_DEBUG_STREAM
diff --git a/src/declarative/qml/qdeclarativeprivate.h b/src/declarative/qml/qdeclarativeprivate.h
index b2d7451..cb916bf 100644
--- a/src/declarative/qml/qdeclarativeprivate.h
+++ b/src/declarative/qml/qdeclarativeprivate.h
@@ -132,6 +132,7 @@ namespace QDeclarativePrivate
template <typename T, bool hasMember>
class has_attachedPropertiesMethod
{
+ public:
typedef int yes_type;
typedef char no_type;
@@ -139,7 +140,6 @@ namespace QDeclarativePrivate
static yes_type check(ReturnType *(*)(QObject *));
static no_type check(...);
- public:
static bool const value = sizeof(check(&T::qmlAttachedProperties)) == sizeof(yes_type);
};
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp
index 071dd07..515c4d6 100644
--- a/src/declarative/qml/qdeclarativeproperty.cpp
+++ b/src/declarative/qml/qdeclarativeproperty.cpp
@@ -640,7 +640,7 @@ QDeclarativePropertyPrivate::binding(const QDeclarativeProperty &that)
is assumed by the caller.
\a flags is passed through to the binding and is used for the initial update (when
- the binding sets the intial value, it will use these flags for the write).
+ the binding sets the initial value, it will use these flags for the write).
*/
QDeclarativeAbstractBinding *
QDeclarativePropertyPrivate::setBinding(const QDeclarativeProperty &that,
diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp
index f703cf5..0657f49 100644
--- a/src/declarative/qml/qdeclarativescriptparser.cpp
+++ b/src/declarative/qml/qdeclarativescriptparser.cpp
@@ -760,7 +760,7 @@ bool ProcessAST::visit(AST::UiArrayBinding *node)
prop->listValueRange.offset = node->lbracketToken.offset;
prop->listValueRange.length = node->rbracketToken.offset + node->rbracketToken.length - node->lbracketToken.offset;
- // Store the positions of the comma token too, again for the DOM to be able to retreive it.
+ // Store the positions of the comma token too, again for the DOM to be able to retrieve it.
prop->listCommaPositions = collectCommas(node->members);
while (propertyCount--)
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 6a9cf95..b901bb3 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -645,12 +645,13 @@ QAbstractAnimation *QDeclarativePauseAnimation::qtAnimation()
Like any other animation element, a ColorAnimation can be applied in a
number of ways, including transitions, behaviors and property value
- sources. The \l PropertyAnimation documentation shows a variety of methods
+ sources. The \l {QML Animation} documentation shows a variety of methods
for creating animations.
- When used in a transition, ColorAnimation will by default animate
- all properties of type color that have changed. If a \l{PropertyAnimation::}{property}
- or \l{PropertyAnimation::}{properties} are explicitly set for the animation,
+ For convenience, when a ColorAnimation is used in a \l Transition, it will
+ animate any \c color properties that have been modified during the state
+ change. If a \l{PropertyAnimation::}{property} or
+ \l{PropertyAnimation::}{properties} are explicitly set for the animation,
then those are used instead.
\sa {QML Animation}, {declarative/animation/basics}{Animation basics example}
@@ -1143,7 +1144,7 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions,
Like any other animation element, a NumberAnimation can be applied in a
number of ways, including transitions, behaviors and property value
- sources. The \l PropertyAnimation documentation shows a variety of methods
+ sources. The \l {QML Animation} documentation shows a variety of methods
for creating animations.
Note that NumberAnimation may not animate smoothly if there are irregular
@@ -1244,6 +1245,11 @@ void QDeclarativeNumberAnimation::setTo(qreal t)
Vector3dAnimation is a specialized PropertyAnimation that defines an
animation to be applied when a Vector3d value changes.
+ Like any other animation element, a Vector3dAnimation can be applied in a
+ number of ways, including transitions, behaviors and property value
+ sources. The \l {QML Animation} documentation shows a variety of methods
+ for creating animations.
+
\sa {QML Animation}, {declarative/animation/basics}{Animation basics example}
*/
@@ -1323,7 +1329,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t)
\snippet doc/src/snippets/declarative/rotationanimation.qml 0
- Notice the RotationAnimation did not need to set a \l {RotationAnimation::}{target}
+ Notice the RotationAnimation did not need to set a \l {PropertyAnimation::}{target}
value. As a convenience, when used in a transition, RotationAnimation will rotate all
properties named "rotation" or "angle". You can override this by providing
your own properties via \l {PropertyAnimation::properties}{properties} or
@@ -1331,7 +1337,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t)
Like any other animation element, a RotationAnimation can be applied in a
number of ways, including transitions, behaviors and property value
- sources. The \l PropertyAnimation documentation shows a variety of methods
+ sources. The \l {QML Animation} documentation shows a variety of methods
for creating animations.
\sa {QML Animation}, {declarative/animation/basics}{Animation basics example}
@@ -1554,7 +1560,7 @@ QDeclarativeListProperty<QDeclarativeAbstractAnimation> QDeclarativeAnimationGro
Like any other animation element, a SequentialAnimation can be applied in a
number of ways, including transitions, behaviors and property value
- sources. The \l PropertyAnimation documentation shows a variety of methods
+ sources. The \l {QML Animation} documentation shows a variety of methods
for creating animations.
\note Once an animation has been grouped into a SequentialAnimation or
@@ -1623,7 +1629,7 @@ void QDeclarativeSequentialAnimation::transition(QDeclarativeStateActions &actio
Like any other animation element, a ParallelAnimation can be applied in a
number of ways, including transitions, behaviors and property value
- sources. The \l PropertyAnimation documentation shows a variety of methods
+ sources. The \l {QML Animation} documentation shows a variety of methods
for creating animations.
\note Once an animation has been grouped into a SequentialAnimation or
@@ -2396,8 +2402,7 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions
\inherits Animation
\brief The ParentAnimation element animates changes in parent values.
- ParentAnimation defines an animation to applied when a ParentChange
- occurs. This allows parent changes to be smoothly animated.
+ ParentAnimation is used to animate a parent change for an \l Item.
For example, the following ParentChange changes \c blueRect to become
a child of \c redRect when it is clicked. The inclusion of the
@@ -2415,10 +2420,16 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions
to animate the parent change via another item that does not have clipping
enabled. Such an item can be set using the \l via property.
- By default, when used in a transition, ParentAnimation animates all parent
- changes. This can be overridden by setting a specific target item using the
+ For convenience, when a ParentAnimation is used in a \l Transition, it will
+ animate any ParentChange that has occurred during the state change.
+ This can be overridden by setting a specific target item using the
\l target property.
+ Like any other animation element, a ParentAnimation can be applied in a
+ number of ways, including transitions, behaviors and property value
+ sources. The \l {QML Animation} documentation shows a variety of methods
+ for creating animations.
+
\sa {QML Animation}, {declarative/animation/basics}{Animation basics example}
*/
@@ -2750,14 +2761,23 @@ QAbstractAnimation *QDeclarativeParentAnimation::qtAnimation()
\inherits Animation
\brief The AnchorAnimation element animates changes in anchor values.
- AnchorAnimation is used to animate an AnchorChange. It will anchor all
- anchor changes specified in a \l State.
+ AnchorAnimation is used to animate an anchor change.
In the following snippet we animate the addition of a right anchor to a \l Rectangle:
\snippet doc/src/snippets/declarative/anchoranimation.qml 0
- \sa AnchorChanges
+ For convenience, when an AnchorAnimation is used in a \l Transition, it will
+ animate any AnchorChanges that have occurred during the state change.
+ This can be overridden by setting a specific target item using the
+ \l target property.
+
+ Like any other animation element, an AnchorAnimation can be applied in a
+ number of ways, including transitions, behaviors and property value
+ sources. The \l {QML Animation} documentation shows a variety of methods
+ for creating animations.
+
+ \sa {QML Animation}, AnchorChanges
*/
QDeclarativeAnchorAnimation::QDeclarativeAnchorAnimation(QObject *parent)
diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp
index fadb2ae..1e7f81a 100644
--- a/src/declarative/util/qdeclarativebehavior.cpp
+++ b/src/declarative/util/qdeclarativebehavior.cpp
@@ -84,12 +84,15 @@ public:
\snippet doc/src/snippets/declarative/behavior.qml 0
- To run multiple animations within a Behavior, use ParallelAnimation or
+ Note that a property cannot have more than one assigned Behavior. To provide
+ multiple animations within a Behavior, use ParallelAnimation or
SequentialAnimation.
- Note that a property cannot have more than one assigned Behavior.
+ If a \l{QML States}{state change} has a \l Transition that matches the same property as a
+ Behavior, the \l Transition animation overrides the Behavior for that
+ state change.
- \sa {Property Behaviors}, {declarative/animation/behaviors}{Behavior example}, QtDeclarative
+ \sa {QML Animation}, {declarative/animation/behaviors}{Behavior example}, QtDeclarative
*/
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 3ede335..20fe3a9 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -108,9 +108,9 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM
\snippet doc/src/snippets/declarative/listmodel-modify.qml delegate
- When creating content dynamically, note that the set of available properties cannot be changed
- except by first clearing the model. Whatever properties are first added to the model are then the
- only permitted properties in the model until it is cleared.
+ Note that when creating content dynamically the set of available properties cannot be changed
+ once set. Whatever properties are first added to the model are the
+ only permitted properties in the model.
\section2 Using threaded list models with WorkerScript
@@ -283,8 +283,7 @@ int QDeclarativeListModel::count() const
/*!
\qmlmethod ListModel::clear()
- Deletes all content from the model. The properties are cleared such that
- different properties may be set on subsequent additions.
+ Deletes all content from the model.
\sa append() remove()
*/
@@ -945,13 +944,14 @@ bool FlatListModel::addValue(const QScriptValue &value, QHash<int, QVariant> *ro
}
NestedListModel::NestedListModel(QDeclarativeListModel *base)
- : _root(0), m_listModel(base), _rolesOk(false)
+ : _root(0), m_ownsRoot(false), m_listModel(base), _rolesOk(false)
{
}
NestedListModel::~NestedListModel()
{
- delete _root;
+ if (m_ownsRoot)
+ delete _root;
}
QVariant NestedListModel::valueForNode(ModelNode *node, bool *hasNested) const
@@ -1051,8 +1051,8 @@ void NestedListModel::clear()
_rolesOk = false;
roleStrings.clear();
- delete _root;
- _root = 0;
+ if (_root)
+ _root->clear();
}
void NestedListModel::remove(int index)
@@ -1067,8 +1067,10 @@ void NestedListModel::remove(int index)
bool NestedListModel::insert(int index, const QScriptValue& valuemap)
{
- if (!_root)
+ if (!_root) {
_root = new ModelNode;
+ m_ownsRoot = true;
+ }
ModelNode *mn = new ModelNode;
mn->setObjectValue(valuemap);
@@ -1099,8 +1101,10 @@ void NestedListModel::move(int from, int to, int n)
bool NestedListModel::append(const QScriptValue& valuemap)
{
- if (!_root)
+ if (!_root) {
_root = new ModelNode;
+ m_ownsRoot = true;
+ }
ModelNode *mn = new ModelNode;
mn->setObjectValue(valuemap);
_root->values << qVariantFromValue(mn);
@@ -1205,16 +1209,22 @@ ModelNode::ModelNode()
ModelNode::~ModelNode()
{
- qDeleteAll(properties.values());
+ clear();
+ if (modelCache) { modelCache->m_nested->_root = 0/* ==this */; delete modelCache; modelCache = 0; }
+ if (objectCache) { delete objectCache; objectCache = 0; }
+}
+void ModelNode::clear()
+{
ModelNode *node;
for (int ii = 0; ii < values.count(); ++ii) {
node = qvariant_cast<ModelNode *>(values.at(ii));
if (node) { delete node; node = 0; }
}
+ values.clear();
- if (modelCache) { modelCache->m_nested->_root = 0/* ==this */; delete modelCache; modelCache = 0; }
- if (objectCache) { delete objectCache; objectCache = 0; }
+ qDeleteAll(properties.values());
+ properties.clear();
}
void ModelNode::setObjectValue(const QScriptValue& valuemap) {
diff --git a/src/declarative/util/qdeclarativelistmodel_p_p.h b/src/declarative/util/qdeclarativelistmodel_p_p.h
index 532eefa..8231414 100644
--- a/src/declarative/util/qdeclarativelistmodel_p_p.h
+++ b/src/declarative/util/qdeclarativelistmodel_p_p.h
@@ -130,6 +130,7 @@ public:
void checkRoles() const;
ModelNode *_root;
+ bool m_ownsRoot;
QDeclarativeListModel *m_listModel;
private:
@@ -157,6 +158,8 @@ struct ModelNode
QList<QVariant> values;
QHash<QString, ModelNode *> properties;
+ void clear();
+
QDeclarativeListModel *model(const NestedListModel *model) {
if (!modelCache) {
modelCache = new QDeclarativeListModel;
diff --git a/src/declarative/util/qdeclarativepropertymap.cpp b/src/declarative/util/qdeclarativepropertymap.cpp
index 919727f..6b43040 100644
--- a/src/declarative/util/qdeclarativepropertymap.cpp
+++ b/src/declarative/util/qdeclarativepropertymap.cpp
@@ -104,22 +104,25 @@ void QDeclarativePropertyMapMetaObject::propertyCreated(int, QMetaPropertyBuilde
The following example shows how you might declare data in C++ and then
access it in QML.
- Setup in C++:
+ In the C++ file:
\code
- //create our data
+ // create our data
QDeclarativePropertyMap ownerData;
ownerData.insert("name", QVariant(QString("John Smith")));
ownerData.insert("phone", QVariant(QString("555-5555")));
- //expose it to the UI layer
- QDeclarativeContext *ctxt = view->rootContext();
- ctxt->setProperty("owner", &data);
+ // expose it to the UI layer
+ QDeclarativeView view;
+ QDeclarativeContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("owner", &ownerData);
+
+ view.setSource(QUrl::fromLocalFile("main.qml"));
+ view.show();
\endcode
- Then, in QML:
+ Then, in \c main.qml:
\code
- Text { text: owner.name }
- Text { text: owner.phone }
+ Text { text: owner.name + " " + owner.phone }
\endcode
The binding is dynamic - whenever a key's value is updated, anything bound to that
diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp
index 727f427..30e1491 100644
--- a/src/declarative/util/qdeclarativesmoothedanimation.cpp
+++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp
@@ -287,7 +287,7 @@ void QSmoothedAnimation::init()
Like any other animation element, a SmoothedAnimation can be applied in a
number of ways, including transitions, behaviors and property value
- sources. The \l PropertyAnimation documentation shows a variety of methods
+ sources. The \l {QML Animation} documentation shows a variety of methods
for creating animations.
\sa SpringAnimation, NumberAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example}
diff --git a/src/declarative/util/qdeclarativespringanimation.cpp b/src/declarative/util/qdeclarativespringanimation.cpp
index cfc7b8e..6f4ac51 100644
--- a/src/declarative/util/qdeclarativespringanimation.cpp
+++ b/src/declarative/util/qdeclarativespringanimation.cpp
@@ -228,6 +228,7 @@ void QDeclarativeSpringAnimationPrivate::updateMode()
/*!
\qmlclass SpringAnimation QDeclarativeSpringAnimation
+ \inherits Animation
\since 4.7
\brief The SpringAnimation element allows a property to track a value in a spring-like motion.
@@ -246,7 +247,7 @@ void QDeclarativeSpringAnimationPrivate::updateMode()
Like any other animation element, a SpringAnimation can be applied in a
number of ways, including transitions, behaviors and property value
- sources. The \l PropertyAnimation documentation shows a variety of methods
+ sources. The \l {QML Animation} documentation shows a variety of methods
for creating animations.
\sa SmoothedAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example}, {declarative/toys/clocks}{Clocks example}
diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp
index 0d43d21..028bacb 100644
--- a/src/declarative/util/qdeclarativestate.cpp
+++ b/src/declarative/util/qdeclarativestate.cpp
@@ -154,13 +154,14 @@ QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObje
Notice the default state is referred to using an empty string ("").
- States are commonly used together with \l {state-transitions}{Transitions} to provide
+ States are commonly used together with \l {Transitions} to provide
animations when state changes occur.
\note Setting the state of an object from within another state of the same object is
not allowed.
- \sa {declarative/animation/states}{states example}, {qmlstates}{States}, {state-transitions}{Transitions}, QtDeclarative
+ \sa {declarative/animation/states}{states example}, {qmlstates}{States},
+ {qdeclarativeanimation.html#transitions}{QML Transitions}, QtDeclarative
*/
/*!
diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp
index 67cd12e..1c1e964 100644
--- a/src/declarative/util/qdeclarativestategroup.cpp
+++ b/src/declarative/util/qdeclarativestategroup.cpp
@@ -112,7 +112,7 @@ public:
}
\endqml
- \sa {qmlstate}{States} {state-transitions}{Transitions}, {QtDeclarative}
+ \sa {qmlstate}{States} {Transitions}, {QtDeclarative}
*/
QDeclarativeStateGroup::QDeclarativeStateGroup(QObject *parent)
@@ -204,7 +204,7 @@ void QDeclarativeStateGroupPrivate::clear_states(QDeclarativeListProperty<QDecla
}
\endqml
- \sa {state-transitions}{Transitions}
+ \sa {Transitions}
*/
QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeStateGroup::transitionsProperty()
{
diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp
index 582191b..7042d0c 100644
--- a/src/declarative/util/qdeclarativetransition.cpp
+++ b/src/declarative/util/qdeclarativetransition.cpp
@@ -60,12 +60,25 @@ QT_BEGIN_NAMESPACE
For example, the following \l Rectangle has two states: the default state, and
an added "moved" state. In the "moved state, the rectangle's position changes
- to (50, 50). The added \l Transition specifies that when the rectangle
+ to (50, 50). The added Transition specifies that when the rectangle
changes between the default and the "moved" state, any changes
to the \c x and \c y properties should be animated, using an \c Easing.InOutQuad.
\snippet doc/src/snippets/declarative/transition.qml 0
+ Notice the example does not require \l{PropertyAnimation::}{to} and
+ \l{PropertyAnimation::}{from} values for the NumberAnimation. As a convenience,
+ these properties are automatically set to the values of \c x and \c y before
+ and after the state change; the \c from values are provided by
+ the current values of \c x and \c y, and the \c to values are provided by
+ the PropertyChanges object. If you wish, you can provide \l{PropertyAnimation::}{to} and
+ \l{PropertyAnimation::}{from} values anyway to override the default values.
+
+ By default, a Transition's animations are applied for any state change in the
+ parent item. The Transition \l {Transition::}{from} and \l {Transition::}{to}
+ values can be set to restrict the animations to only be applied when changing
+ from one particular state to another.
+
To define multiple transitions, specify \l Item::transitions as a list:
\qml
@@ -78,7 +91,11 @@ QT_BEGIN_NAMESPACE
}
\endqml
- \sa {declarative/animation/states}{states example}, {qmlstates}{States}, {state-transitions}{Transitions}, {QtDeclarative}
+ If a state change has a Transition that matches the same property as a
+ \l Behavior, the Transition animation overrides the \l Behavior for that
+ state change.
+
+ \sa {QML Animation}, {declarative/animation/states}{states example}, {qmlstates}{States}, {QtDeclarative}
*/
/*!
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index 7c1e1fd..8bd829e 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -560,7 +560,7 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
ListView {
width: 180; height: 300
model: xmlModel
- delegate: Text { text: title + " (" + pubDate + ")" }
+ delegate: Text { text: title + ": " + pubDate }
}
\endqml
@@ -855,6 +855,12 @@ qreal QDeclarativeXmlListModel::progress() const
return d->progress;
}
+/*!
+ \qmlmethod void XmlListModel::errorString()
+
+ Returns a string description of the last error that occurred
+ if \l status is XmlListModel::Error.
+*/
QString QDeclarativeXmlListModel::errorString() const
{
Q_D(const QDeclarativeXmlListModel);