summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-06-24 22:46:58 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-06-24 22:46:58 (GMT)
commit329546aab7a9297813a6b6a28b23fd3750838ddb (patch)
tree8bb631907fb5709e855ee5df3599701504a6f7c3 /src/declarative
parent098e1939cfdf675ae850912d898f1af0b2c660cc (diff)
parent83449457780f4321595ec5f15056474cc22061da (diff)
downloadQt-329546aab7a9297813a6b6a28b23fd3750838ddb.zip
Qt-329546aab7a9297813a6b6a28b23fd3750838ddb.tar.gz
Qt-329546aab7a9297813a6b6a28b23fd3750838ddb.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/canvas/qsimplecanvas.cpp6
-rw-r--r--src/declarative/fx/qfxflowview.cpp9
-rw-r--r--src/declarative/qml/qmlengine.cpp22
-rw-r--r--src/declarative/util/qmlanimation.cpp62
-rw-r--r--src/declarative/util/qmlanimation.h6
-rw-r--r--src/declarative/util/qmlanimation_p.h3
6 files changed, 95 insertions, 13 deletions
diff --git a/src/declarative/canvas/qsimplecanvas.cpp b/src/declarative/canvas/qsimplecanvas.cpp
index cb46f94..a4998dc 100644
--- a/src/declarative/canvas/qsimplecanvas.cpp
+++ b/src/declarative/canvas/qsimplecanvas.cpp
@@ -883,9 +883,9 @@ QRect QSimpleCanvasPrivate::resetDirty()
dirtyItems.clear();
oldDirty = QRect();
- if (fullUpdate())
+ /*if (fullUpdate())
return QRect();
- else
+ else*/
return r;
} else {
return QRect();
@@ -934,7 +934,7 @@ bool QSimpleCanvas::event(QEvent *e)
QRect r = d->resetDirty();
#if defined(QFX_RENDER_QPAINTER)
- if (r.isEmpty() || fullUpdate())
+ if (fullUpdate())
repaint();
else
repaint(r);
diff --git a/src/declarative/fx/qfxflowview.cpp b/src/declarative/fx/qfxflowview.cpp
index e02e186..77cd6df 100644
--- a/src/declarative/fx/qfxflowview.cpp
+++ b/src/declarative/fx/qfxflowview.cpp
@@ -128,10 +128,11 @@ void QFxFlowView::refresh()
{
if (m_model && m_columns >= 1) {
for (int ii = 0; ii < m_model->count(); ++ii) {
- QFxItem *item = m_model->item(ii);
- item->setParent(this);
- item->setZ(0);
- m_items << item;
+ if (QFxItem *item = m_model->item(ii)) {
+ item->setParent(this);
+ item->setZ(0);
+ m_items << item;
+ }
}
reflow();
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 36b6424..8c926b7 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -1160,14 +1160,26 @@ QVariant QmlExpression::value()
}
rv = QVariant::fromValue(list);
}
- } else if (svalue.isObject()) {
+ } else if (svalue.isObject() &&
+ !svalue.isNumber() &&
+ !svalue.isString() &&
+ !svalue.isDate() &&
+ !svalue.isError() &&
+ !svalue.isFunction() &&
+ !svalue.isNull() &&
+ !svalue.isQMetaObject() &&
+ !svalue.isQObject() &&
+ !svalue.isRegExp()) {
QScriptValue objValue = svalue.data();
- if (objValue.isValid())
- rv = objValue.toVariant();
+ if (objValue.isValid()) {
+ QVariant var = objValue.toVariant();
+ if (var.userType() >= (int)QVariant::UserType &&
+ QmlMetaType::isObject(var.userType()))
+ rv = var;
+ }
}
- if (rv.isNull()) {
+ if (rv.isNull())
rv = svalue.toVariant();
- }
for (int i = 0; i < context()->d_func()->scopeChain.size(); ++i) {
scriptEngine->currentContext()->popScope();
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index 7df249e..2a6cad9 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -255,6 +255,44 @@ void QmlAbstractAnimation::setRunning(bool r)
emit runningChanged(d->running);
}
+/*!
+ \qmlproperty bool Animation::paused
+ This property holds whether the animation is currently paused.
+
+ The \c paused property can be set to declaratively control whether or not
+ an animation is paused.
+
+ Animations can also be paused and resumed imperatively from JavaScript
+ using the \c pause() and \c resume() methods.
+
+ By default, animations are not paused.
+*/
+bool QmlAbstractAnimation::isPaused() const
+{
+ Q_D(const QmlAbstractAnimation);
+ return d->paused;
+}
+
+void QmlAbstractAnimation::setPaused(bool p)
+{
+ Q_D(QmlAbstractAnimation);
+ if (d->paused == p)
+ return;
+
+ if (d->group) {
+ qWarning("QmlAbstractAnimation: setPaused() cannot be used on non-root animation nodes");
+ return;
+ }
+
+ d->paused = p;
+ if (d->paused)
+ qtAnimation()->pause();
+ else
+ qtAnimation()->resume();
+
+ emit pausedChanged(d->running);
+}
+
void QmlAbstractAnimation::classBegin()
{
Q_D(QmlAbstractAnimation);
@@ -430,6 +468,30 @@ void QmlAbstractAnimation::start()
}
/*!
+ \qmlmethod Animation::pause()
+ \brief Pauses the animation.
+
+ If the animation is already paused, calling this method has no effect. The
+ \c paused property will be true following a call to \c pause().
+*/
+void QmlAbstractAnimation::pause()
+{
+ setPaused(true);
+}
+
+/*!
+ \qmlmethod Animation::resume()
+ \brief Resumes a paused animation.
+
+ If the animation is not paused, calling this method has no effect. The
+ \c paused property will be false following a call to \c resume().
+*/
+void QmlAbstractAnimation::resume()
+{
+ setPaused(false);
+}
+
+/*!
\qmlmethod Animation::stop()
\brief Stops the animation.
diff --git a/src/declarative/util/qmlanimation.h b/src/declarative/util/qmlanimation.h
index 5ab9dda..0452159 100644
--- a/src/declarative/util/qmlanimation.h
+++ b/src/declarative/util/qmlanimation.h
@@ -65,6 +65,7 @@ class QmlAbstractAnimation : public QmlPropertyValueSource, public QmlParserStat
Q_INTERFACES(QmlParserStatus)
Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
+ Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged)
Q_PROPERTY(bool finishPlaying READ finishPlaying WRITE setFinishPlaying NOTIFY finishPlayingChanged())
Q_PROPERTY(bool repeat READ repeat WRITE setRepeat NOTIFY repeatChanged)
Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
@@ -78,6 +79,8 @@ public:
bool isRunning() const;
void setRunning(bool);
+ bool isPaused() const;
+ void setPaused(bool);
bool finishPlaying() const;
void setFinishPlaying(bool);
bool repeat() const;
@@ -100,6 +103,7 @@ Q_SIGNALS:
void started();
void completed();
void runningChanged(bool);
+ void pausedChanged(bool);
void repeatChanged(bool);
void targetChanged(QObject *, const QString &);
void finishPlayingChanged(bool);
@@ -107,6 +111,8 @@ Q_SIGNALS:
public Q_SLOTS:
void restart();
void start();
+ void pause();
+ void resume();
void stop();
void complete();
diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h
index e5a7384..f09ab88 100644
--- a/src/declarative/util/qmlanimation_p.h
+++ b/src/declarative/util/qmlanimation_p.h
@@ -172,11 +172,12 @@ class QmlAbstractAnimationPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QmlAbstractAnimation)
public:
QmlAbstractAnimationPrivate()
- : running(false), finishPlaying(false), repeat(false),
+ : running(false), paused(false), finishPlaying(false), repeat(false),
connectedTimeLine(false), componentComplete(true), startOnCompletion(false),
target(0), group(0) {}
bool running;
+ bool paused;
bool finishPlaying;
bool repeat;
bool connectedTimeLine;