summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-07-20 06:27:12 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-07-20 06:27:12 (GMT)
commit3182e16fa31a7def9775375971bea203af419d76 (patch)
tree088f3ba8666cc965979720cb95d530d4d4700465 /src
parentebcec1a247c4cb67537131c0d801780f4987a810 (diff)
parent8ce0234b9aa4093c86179f038bdbd281b72a829a (diff)
downloadQt-3182e16fa31a7def9775375971bea203af419d76.zip
Qt-3182e16fa31a7def9775375971bea203af419d76.tar.gz
Qt-3182e16fa31a7def9775375971bea203af419d76.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src')
-rw-r--r--src/declarative/extra/qfxflowview.cpp4
-rw-r--r--src/declarative/extra/qfxflowview.h6
-rw-r--r--src/declarative/extra/qmlbehaviour.cpp4
-rw-r--r--src/declarative/fx/qfxgridview.cpp6
-rw-r--r--src/declarative/fx/qfxlistview.cpp10
-rw-r--r--src/declarative/fx/qfxvisualitemmodel.cpp2
-rw-r--r--src/declarative/util/qmlfollow.cpp29
-rw-r--r--src/declarative/util/qmlfollow.h3
8 files changed, 43 insertions, 21 deletions
diff --git a/src/declarative/extra/qfxflowview.cpp b/src/declarative/extra/qfxflowview.cpp
index 412cbc8..1676512 100644
--- a/src/declarative/extra/qfxflowview.cpp
+++ b/src/declarative/extra/qfxflowview.cpp
@@ -49,8 +49,8 @@ QT_BEGIN_NAMESPACE
class QFxFlowViewAttached : public QObject
{
Q_OBJECT
-Q_PROPERTY(int row READ row NOTIFY posChanged);
-Q_PROPERTY(int column READ column NOTIFY posChanged);
+Q_PROPERTY(int row READ row NOTIFY posChanged)
+Q_PROPERTY(int column READ column NOTIFY posChanged)
public:
QFxFlowViewAttached(QObject *parent);
diff --git a/src/declarative/extra/qfxflowview.h b/src/declarative/extra/qfxflowview.h
index 126f567..c2b30a3 100644
--- a/src/declarative/extra/qfxflowview.h
+++ b/src/declarative/extra/qfxflowview.h
@@ -58,8 +58,8 @@ class Q_DECLARATIVE_EXPORT QFxFlowView : public QFxItem
{
Q_OBJECT
Q_PROPERTY(QFxVisualItemModel *model READ model WRITE setModel)
- Q_PROPERTY(int column READ columns WRITE setColumns);
- Q_PROPERTY(bool vertical READ vertical WRITE setVertical);
+ Q_PROPERTY(int column READ columns WRITE setColumns)
+ Q_PROPERTY(bool vertical READ vertical WRITE setVertical)
public:
QFxFlowView();
@@ -101,7 +101,7 @@ private:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QFxFlowView);
+QML_DECLARE_TYPE(QFxFlowView)
QT_END_HEADER
diff --git a/src/declarative/extra/qmlbehaviour.cpp b/src/declarative/extra/qmlbehaviour.cpp
index c7ab1da..92a85b0 100644
--- a/src/declarative/extra/qmlbehaviour.cpp
+++ b/src/declarative/extra/qmlbehaviour.cpp
@@ -57,8 +57,8 @@ public:
QmlBehaviourData(QObject *parent)
: QObject(parent) {}
- Q_PROPERTY(QVariant endValue READ endValue NOTIFY valuesChanged);
- Q_PROPERTY(QVariant startValue READ startValue NOTIFY valuesChanged);
+ Q_PROPERTY(QVariant endValue READ endValue NOTIFY valuesChanged)
+ Q_PROPERTY(QVariant startValue READ startValue NOTIFY valuesChanged)
QVariant endValue() const { return e; }
QVariant startValue() const { return s; }
diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp
index 905af3b..3c80e98 100644
--- a/src/declarative/fx/qfxgridview.cpp
+++ b/src/declarative/fx/qfxgridview.cpp
@@ -59,10 +59,10 @@ public:
attachedProperties.remove(parent());
}
- Q_PROPERTY(QFxGridView *view READ view);
+ Q_PROPERTY(QFxGridView *view READ view)
QFxGridView *view() { return m_view; }
- Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged);
+ Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged)
bool isCurrentItem() const { return m_isCurrent; }
void setIsCurrentItem(bool c) {
if (m_isCurrent != c) {
@@ -71,7 +71,7 @@ public:
}
}
- Q_PROPERTY(bool delayRemove READ delayRemove WRITE setDelayRemove NOTIFY delayRemoveChanged);
+ Q_PROPERTY(bool delayRemove READ delayRemove WRITE setDelayRemove NOTIFY delayRemoveChanged)
bool delayRemove() const { return m_delayRemove; }
void setDelayRemove(bool delay) {
if (m_delayRemove != delay) {
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp
index 351365d..50564fb 100644
--- a/src/declarative/fx/qfxlistview.cpp
+++ b/src/declarative/fx/qfxlistview.cpp
@@ -59,10 +59,10 @@ public:
attachedProperties.remove(parent());
}
- Q_PROPERTY(QFxListView *view READ view);
+ Q_PROPERTY(QFxListView *view READ view)
QFxListView *view() { return m_view; }
- Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged);
+ Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged)
bool isCurrentItem() const { return m_isCurrent; }
void setIsCurrentItem(bool c) {
if (m_isCurrent != c) {
@@ -71,7 +71,7 @@ public:
}
}
- Q_PROPERTY(QString prevSection READ prevSection NOTIFY prevSectionChanged);
+ Q_PROPERTY(QString prevSection READ prevSection NOTIFY prevSectionChanged)
QString prevSection() const { return m_prevSection; }
void setPrevSection(const QString &sect) {
if (m_prevSection != sect) {
@@ -80,7 +80,7 @@ public:
}
}
- Q_PROPERTY(QString section READ section NOTIFY sectionChanged);
+ Q_PROPERTY(QString section READ section NOTIFY sectionChanged)
QString section() const { return m_section; }
void setSection(const QString &sect) {
if (m_section != sect) {
@@ -89,7 +89,7 @@ public:
}
}
- Q_PROPERTY(bool delayRemove READ delayRemove WRITE setDelayRemove NOTIFY delayRemoveChanged);
+ Q_PROPERTY(bool delayRemove READ delayRemove WRITE setDelayRemove NOTIFY delayRemoveChanged)
bool delayRemove() const { return m_delayRemove; }
void setDelayRemove(bool delay) {
if (m_delayRemove != delay) {
diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp
index eb10df3..1b15a48 100644
--- a/src/declarative/fx/qfxvisualitemmodel.cpp
+++ b/src/declarative/fx/qfxvisualitemmodel.cpp
@@ -160,7 +160,7 @@ Q_OBJECT
public:
QFxVisualItemModelData(int index, QFxVisualItemModelPrivate *model);
- Q_PROPERTY(int index READ index NOTIFY indexChanged);
+ Q_PROPERTY(int index READ index NOTIFY indexChanged)
int index() const;
void setIndex(int index);
diff --git a/src/declarative/util/qmlfollow.cpp b/src/declarative/util/qmlfollow.cpp
index 1e4468c..1e6fea2 100644
--- a/src/declarative/util/qmlfollow.cpp
+++ b/src/declarative/util/qmlfollow.cpp
@@ -56,7 +56,7 @@ class QmlFollowPrivate : public QObjectPrivate
public:
QmlFollowPrivate()
: sourceValue(0), maxVelocity(0), lastTime(0)
- , mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.005), modulus(0.0), enabled(true), mode(Track), clock(this) {}
+ , mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.01), modulus(0.0), enabled(true), mode(Track), clock(this) {}
QmlMetaProperty property;
qreal currentValue;
@@ -164,8 +164,10 @@ void QmlFollowPrivate::tick(int time)
}
lastTime = time;
}
- emit q->valueChanged(currentValue);
property.write(currentValue);
+ emit q->valueChanged(currentValue);
+ if (clock.state() != QAbstractAnimation::Running)
+ emit q->syncChanged();
}
void QmlFollowPrivate::updateMode()
@@ -183,6 +185,7 @@ void QmlFollowPrivate::start()
if (!enabled)
return;
+ Q_Q(QmlFollow);
if (mode == QmlFollowPrivate::Track) {
currentValue = sourceValue;
property.write(currentValue);
@@ -190,6 +193,7 @@ void QmlFollowPrivate::start()
lastTime = 0;
currentValue = property.read().toDouble();
clock.start(); // infinity??
+ emit q->syncChanged();
}
}
@@ -262,8 +266,10 @@ qreal QmlFollow::sourceValue() const
void QmlFollow::setSourceValue(qreal value)
{
Q_D(QmlFollow);
- d->sourceValue = value;
- d->start();
+ if (d->sourceValue != value) {
+ d->sourceValue = value;
+ d->start();
+ }
}
/*!
@@ -339,7 +345,7 @@ void QmlFollow::setDamping(qreal damping)
to 0 to be considered equal to zero. This will depend on the usage of the value.
For pixel positions, 0.25 would suffice. For scale, 0.005 will suffice.
- The default is 0.005. Small performance improvements can result in tuning this
+ The default is 0.01. Small performance improvements can result in tuning this
value.
*/
qreal QmlFollow::epsilon() const
@@ -398,6 +404,19 @@ void QmlFollow::setEnabled(bool enabled)
d->stop();
}
+/*!
+ \qmlproperty bool Follow::inSync
+ This property is true when target is equal to the source; otherwise
+ false. If inSync is true the target is not being animated.
+
+ If \l enabled is false then inSync will also be false.
+*/
+bool QmlFollow::inSync() const
+{
+ Q_D(const QmlFollow);
+ return d->enabled && d->clock.state() != QAbstractAnimation::Running;
+}
+
qreal QmlFollow::value() const
{
Q_D(const QmlFollow);
diff --git a/src/declarative/util/qmlfollow.h b/src/declarative/util/qmlfollow.h
index 07e15e9..e0a588b 100644
--- a/src/declarative/util/qmlfollow.h
+++ b/src/declarative/util/qmlfollow.h
@@ -68,6 +68,7 @@ class Q_DECLARATIVE_EXPORT QmlFollow : public QmlPropertyValueSource,
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled)
Q_PROPERTY(qreal followValue READ value NOTIFY valueChanged)
Q_PROPERTY(qreal modulus READ modulus WRITE setModulus NOTIFY modulusChanged)
+ Q_PROPERTY(bool inSync READ inSync NOTIFY syncChanged)
public:
QmlFollow(QObject *parent=0);
@@ -89,11 +90,13 @@ public:
void setModulus(qreal modulus);
bool enabled() const;
void setEnabled(bool enabled);
+ bool inSync() const;
qreal value() const;
Q_SIGNALS:
void valueChanged(qreal);
+ void syncChanged();
};
QT_END_NAMESPACE