summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsgridview.cpp5
-rw-r--r--src/declarative/graphicsitems/qmlgraphicslistview.cpp14
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspath.cpp16
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspath_p.h3
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspath_p_p.h3
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspathview.cpp4
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsrepeater.cpp4
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp7
-rw-r--r--src/declarative/util/qmlanimation.cpp22
9 files changed, 55 insertions, 23 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
index 9465c4c..473f9e5 100644
--- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
@@ -824,7 +824,9 @@ void QmlGraphicsGridView::setModel(const QVariant &model)
/*!
\qmlproperty component GridView::delegate
- The delegate provides a template describing what each item in the view should look and act like.
+ The delegate provides a template defining each item instantiated by the view.
+ The index is exposed as an accessible \c index property. Properties of the
+ model are also available depending upon the type of \l {qmlmodels}{Data Model}.
Here is an example delegate:
\snippet doc/src/snippets/declarative/gridview/gridview.qml 0
@@ -948,7 +950,6 @@ void QmlGraphicsGridView::setHighlight(QmlComponent *highlight)
{
Q_D(QmlGraphicsGridView);
if (highlight != d->highlightComponent) {
- delete d->highlightComponent;
d->highlightComponent = highlight;
d->updateCurrent(d->currentIndex);
}
diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp
index c075a8a..c6291f2 100644
--- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp
@@ -503,7 +503,7 @@ void QmlGraphicsListViewPrivate::refill(qreal from, qreal to)
return;
from -= buffer;
to += buffer;
- int modelIndex = 0;
+ int modelIndex = visibleIndex;
qreal itemEnd = visiblePos-1;
if (!visibleItems.isEmpty()) {
visiblePos = visibleItems.first()->position();
@@ -1139,7 +1139,9 @@ void QmlGraphicsListView::setModel(const QVariant &model)
/*!
\qmlproperty component ListView::delegate
- The delegate provides a template describing what each item in the view should look and act like.
+ The delegate provides a template defining each item instantiated by the view.
+ The index is exposed as an accessible \c index property. Properties of the
+ model are also available depending upon the type of \l {qmlmodels}{Data Model}.
Here is an example delegate:
\snippet doc/src/snippets/declarative/listview/listview.qml 0
@@ -1167,6 +1169,9 @@ void QmlGraphicsListView::setDelegate(QmlComponent *delegate)
if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model)) {
dataModel->setDelegate(delegate);
if (isComponentComplete()) {
+ for (int i = 0; i < d->visibleItems.count(); ++i)
+ d->releaseItem(d->visibleItems.at(i));
+ d->visibleItems.clear();
refill();
d->moveReason = QmlGraphicsListViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
@@ -1266,9 +1271,10 @@ void QmlGraphicsListView::setHighlight(QmlComponent *highlight)
{
Q_D(QmlGraphicsListView);
if (highlight != d->highlightComponent) {
- delete d->highlightComponent;
d->highlightComponent = highlight;
- d->updateCurrent(d->currentIndex);
+ d->createHighlight();
+ if (d->currentItem)
+ d->updateHighlight();
}
}
diff --git a/src/declarative/graphicsitems/qmlgraphicspath.cpp b/src/declarative/graphicsitems/qmlgraphicspath.cpp
index 0812d11..1791074 100644
--- a/src/declarative/graphicsitems/qmlgraphicspath.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspath.cpp
@@ -107,7 +107,7 @@ QmlGraphicsPath::~QmlGraphicsPath()
/*!
\qmlproperty real Path::startX
\qmlproperty real Path::startY
- This property holds the starting position of the path.
+ These properties hold the starting position of the path.
*/
qreal QmlGraphicsPath::startX() const
{
@@ -134,6 +134,16 @@ void QmlGraphicsPath::setStartY(qreal y)
}
/*!
+ \qmlproperty bool Path::closed
+ This property holds whether the start and end of the path are identical.
+*/
+bool QmlGraphicsPath::isClosed() const
+{
+ Q_D(const QmlGraphicsPath);
+ return d->closed;
+}
+
+/*!
\qmlproperty list<PathElement> Path::pathElements
This property holds the objects composing the path.
@@ -220,12 +230,14 @@ void QmlGraphicsPath::processPath()
d->_path.moveTo(d->startX, d->startY);
+ QmlGraphicsCurve *lastCurve = 0;
foreach (QmlGraphicsPathElement *pathElement, d->_pathElements) {
if (QmlGraphicsCurve *curve = qobject_cast<QmlGraphicsCurve *>(pathElement)) {
curve->addToPath(d->_path);
AttributePoint p;
p.origpercent = d->_path.length();
d->_attributePoints << p;
+ lastCurve = curve;
} else if (QmlGraphicsPathAttribute *attribute = qobject_cast<QmlGraphicsPathAttribute *>(pathElement)) {
AttributePoint &point = d->_attributePoints.last();
point.values[attribute->name()] = attribute->value();
@@ -266,6 +278,8 @@ void QmlGraphicsPath::processPath()
}
}
+ d->closed = lastCurve && d->startX == lastCurve->x() && d->startY == lastCurve->y();
+
emit changed();
}
diff --git a/src/declarative/graphicsitems/qmlgraphicspath_p.h b/src/declarative/graphicsitems/qmlgraphicspath_p.h
index 4b0c772..30a377e 100644
--- a/src/declarative/graphicsitems/qmlgraphicspath_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicspath_p.h
@@ -191,6 +191,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsPath : public QObject, public QmlParserSta
Q_PROPERTY(QList<QmlGraphicsPathElement *>* pathElements READ pathElements)
Q_PROPERTY(qreal startX READ startX WRITE setStartX)
Q_PROPERTY(qreal startY READ startY WRITE setStartY)
+ Q_PROPERTY(bool closed READ isClosed NOTIFY changed)
Q_CLASSINFO("DefaultProperty", "pathElements")
Q_INTERFACES(QmlParserStatus)
public:
@@ -205,6 +206,8 @@ public:
qreal startY() const;
void setStartY(qreal y);
+ bool isClosed() const;
+
QPainterPath path() const;
QStringList attributes() const;
qreal attributeAt(const QString &, qreal) const;
diff --git a/src/declarative/graphicsitems/qmlgraphicspath_p_p.h b/src/declarative/graphicsitems/qmlgraphicspath_p_p.h
index 36e8945..8c4c962 100644
--- a/src/declarative/graphicsitems/qmlgraphicspath_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicspath_p_p.h
@@ -64,7 +64,7 @@ class QmlGraphicsPathPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QmlGraphicsPath)
public:
- QmlGraphicsPathPrivate() : startX(0), startY(0) { }
+ QmlGraphicsPathPrivate() : startX(0), startY(0), closed(false) { }
QPainterPath _path;
QList<QmlGraphicsPathElement*> _pathElements;
@@ -73,6 +73,7 @@ public:
QStringList _attributes;
int startX;
int startY;
+ bool closed;
};
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qmlgraphicspathview.cpp b/src/declarative/graphicsitems/qmlgraphicspathview.cpp
index 180954c..92751a0 100644
--- a/src/declarative/graphicsitems/qmlgraphicspathview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspathview.cpp
@@ -298,7 +298,9 @@ void QmlGraphicsPathView::setDragMargin(qreal dragMargin)
/*!
\qmlproperty component PathView::delegate
- The delegate provides a template describing what each item in the view should look and act like.
+ The delegate provides a template defining each item instantiated by the view.
+ The index is exposed as an accessible \c index property. Properties of the
+ model are also available depending upon the type of \l {qmlmodels}{Data Model}.
Here is an example delegate:
\snippet doc/src/snippets/declarative/pathview/pathview.qml 1
diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp
index 7aed760..be10c24 100644
--- a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp
@@ -199,7 +199,9 @@ void QmlGraphicsRepeater::setModel(const QVariant &model)
\qmlproperty Component Repeater::delegate
\default
- The delegate provides a template describing what each item instantiated by the repeater should look and act like.
+ The delegate provides a template defining each item instantiated by the repeater.
+ The index is exposed as an accessible \c index property. Properties of the
+ model are also available depending upon the type of \l {qmlmodels}{Data Model}.
*/
QmlComponent *QmlGraphicsRepeater::delegate() const
{
diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
index cf5fc5e..e8ee196 100644
--- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
@@ -692,11 +692,16 @@ QmlComponent *QmlGraphicsVisualDataModel::delegate() const
void QmlGraphicsVisualDataModel::setDelegate(QmlComponent *delegate)
{
Q_D(QmlGraphicsVisualDataModel);
+ bool wasValid = d->m_delegate != 0;
d->m_delegate = delegate;
- if (d->modelCount()) {
+ if (!wasValid && d->modelCount() && d->m_delegate) {
emit itemsInserted(0, d->modelCount());
emit countChanged();
}
+ if (wasValid && !d->m_delegate && d->modelCount()) {
+ emit itemsRemoved(0, d->modelCount());
+ emit countChanged();
+ }
}
QString QmlGraphicsVisualDataModel::part() const
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index 780bc82..475978f 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -595,7 +595,7 @@ void QmlAbstractAnimation::timelineComplete()
/*!
\qmlclass PauseAnimation QmlPauseAnimation
\inherits Animation
- \brief The PauseAnimation provides a pause for an animation.
+ \brief The PauseAnimation element provides a pause for an animation.
When used in a SequentialAnimation, PauseAnimation is a step when
nothing happens, for a specified duration.
@@ -668,7 +668,7 @@ QAbstractAnimation *QmlPauseAnimation::qtAnimation()
/*!
\qmlclass ColorAnimation QmlColorAnimation
\inherits PropertyAnimation
- \brief The ColorAnimation allows you to animate color changes.
+ \brief The ColorAnimation element allows you to animate color changes.
\code
ColorAnimation { from: "white"; to: "#c0c0c0"; duration: 100 }
@@ -676,7 +676,7 @@ QAbstractAnimation *QmlPauseAnimation::qtAnimation()
When used in a transition, ColorAnimation will by default animate
all properties of type color that are changing. If a property or properties
- are explicity set for the animation, then those will be used instead.
+ are explicitly set for the animation, then those will be used instead.
*/
/*!
\internal
@@ -731,7 +731,7 @@ QML_DEFINE_TYPE(Qt,4,6,ColorAnimation,QmlColorAnimation)
/*!
\qmlclass ScriptAction QmlScriptAction
\inherits Animation
- \brief The ScriptAction allows scripts to be run during an animation.
+ \brief The ScriptAction element allows scripts to be run during an animation.
*/
/*!
@@ -837,7 +837,7 @@ QML_DEFINE_TYPE(Qt,4,6,ScriptAction,QmlScriptAction)
/*!
\qmlclass PropertyAction QmlPropertyAction
\inherits Animation
- \brief The PropertyAction allows immediate property changes during animation.
+ \brief The PropertyAction element allows immediate property changes during animation.
Explicitly set \c theimage.smooth=true during a transition:
\code
@@ -1303,7 +1303,7 @@ QML_DEFINE_TYPE(Qt,4,6,ParentAction,QmlParentAction)
/*!
\qmlclass NumberAnimation QmlNumberAnimation
\inherits PropertyAnimation
- \brief The NumberAnimation allows you to animate changes in properties of type qreal.
+ \brief The NumberAnimation element allows you to animate changes in properties of type qreal.
Animate a set of properties over 200ms, from their values in the start state to
their values in the end state of the transition:
@@ -1381,7 +1381,7 @@ QmlList<QmlAbstractAnimation *> *QmlAnimationGroup::animations()
/*!
\qmlclass SequentialAnimation QmlSequentialAnimation
\inherits Animation
- \brief The SequentialAnimation allows you to run animations sequentially.
+ \brief The SequentialAnimation element allows you to run animations sequentially.
Animations controlled in SequentialAnimation will be run one after the other.
@@ -1456,7 +1456,7 @@ QML_DEFINE_TYPE(Qt,4,6,SequentialAnimation,QmlSequentialAnimation)
/*!
\qmlclass ParallelAnimation QmlParallelAnimation
\inherits Animation
- \brief The ParallelAnimation allows you to run animations in parallel.
+ \brief The ParallelAnimation element allows you to run animations in parallel.
Animations contained in ParallelAnimation will be run at the same time.
@@ -1580,14 +1580,12 @@ void QmlPropertyAnimationPrivate::convertVariant(QVariant &variant, int type)
/*!
\qmlclass PropertyAnimation QmlPropertyAnimation
\inherits Animation
- \brief The PropertyAnimation allows you to animate property changes.
+ \brief The PropertyAnimation element allows you to animate property changes.
Animate a size property over 200ms, from its current size to 20-by-20:
\code
- VariantAnimation { property: "size"; to: "20x20"; duration: 200 }
+ PropertyAnimation { property: "size"; to: "20x20"; duration: 200 }
\endcode
-
- \a qmlanimation.html
*/
QmlPropertyAnimation::QmlPropertyAnimation(QObject *parent)