summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-05-19 08:46:43 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-05-19 08:46:43 (GMT)
commit4871ff0563cf8a9691db8b084dce012aeb5abf47 (patch)
treea546213763b5ab71793c147debf2ef31d1bcc453 /src/declarative/util
parent7a9fb0de42835bc4297ac04b901a33f99680f744 (diff)
downloadQt-4871ff0563cf8a9691db8b084dce012aeb5abf47.zip
Qt-4871ff0563cf8a9691db8b084dce012aeb5abf47.tar.gz
Qt-4871ff0563cf8a9691db8b084dce012aeb5abf47.tar.bz2
Add a SetProperties::restoreEntryValues property to store the state restoring property entry values
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qmlsetproperties.cpp18
-rw-r--r--src/declarative/util/qmlsetproperties.h4
-rw-r--r--src/declarative/util/qmlstate.cpp4
-rw-r--r--src/declarative/util/qmlstate.h1
4 files changed, 24 insertions, 3 deletions
diff --git a/src/declarative/util/qmlsetproperties.cpp b/src/declarative/util/qmlsetproperties.cpp
index 34d3b00..c986864 100644
--- a/src/declarative/util/qmlsetproperties.cpp
+++ b/src/declarative/util/qmlsetproperties.cpp
@@ -113,13 +113,15 @@ class QmlSetPropertiesPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QmlSetProperties)
public:
- QmlSetPropertiesPrivate() : object(0), decoded(true) {}
+ QmlSetPropertiesPrivate() : object(0), decoded(true), restore(true) {}
QObject *object;
QByteArray data;
bool decoded;
void decode();
+ bool restore;
+
QList<QPair<QByteArray, QVariant> > properties;
QList<QPair<QByteArray, QmlExpression *> > expressions;
@@ -264,6 +266,18 @@ void QmlSetProperties::setObject(QObject *o)
d->object = o;
}
+bool QmlSetProperties::restoreEntryValues() const
+{
+ Q_D(const QmlSetProperties);
+ return d->restore;
+}
+
+void QmlSetProperties::setRestoreEntryValues(bool v)
+{
+ Q_D(QmlSetProperties);
+ d->restore = v;
+}
+
QmlMetaProperty
QmlSetPropertiesPrivate::property(const QByteArray &property)
{
@@ -314,6 +328,7 @@ QmlSetProperties::ActionList QmlSetProperties::actions()
if (prop.isValid()) {
Action a;
+ a.restore = restoreEntryValues();
a.property = prop;
a.fromValue = a.property.read();
a.toValue = d->properties.at(ii).second;
@@ -329,6 +344,7 @@ QmlSetProperties::ActionList QmlSetProperties::actions()
if (prop.isValid()) {
Action a;
+ a.restore = restoreEntryValues();
a.property = prop;
a.fromValue = a.property.read();
a.toValue = d->expressions.at(ii).second->value();
diff --git a/src/declarative/util/qmlsetproperties.h b/src/declarative/util/qmlsetproperties.h
index bd036c1..6d313b7 100644
--- a/src/declarative/util/qmlsetproperties.h
+++ b/src/declarative/util/qmlsetproperties.h
@@ -58,6 +58,7 @@ class Q_DECLARATIVE_EXPORT QmlSetProperties : public QmlStateOperation
Q_DECLARE_PRIVATE(QmlSetProperties);
Q_PROPERTY(QObject *target READ object WRITE setObject);
+ Q_PROPERTY(bool restoreEntryValues READ restoreEntryValues WRITE setRestoreEntryValues);
public:
QmlSetProperties();
~QmlSetProperties();
@@ -65,6 +66,9 @@ public:
QObject *object() const;
void setObject(QObject *);
+ bool restoreEntryValues() const;
+ void setRestoreEntryValues(bool);
+
virtual ActionList actions();
};
QML_DECLARE_TYPE(QmlSetProperties);
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index 194cc1b..6261003 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG);
-Action::Action() : bv(0), event(0), actionDone(false)
+Action::Action() : restore(true), bv(0), event(0), actionDone(false)
{
}
@@ -344,7 +344,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
for (int ii = 0; ii < applyList.count(); ++ii) {
const Action &action = applyList.at(ii);
- if (action.event)
+ if (action.event || !action.restore)
continue;
bool found = false;
diff --git a/src/declarative/util/qmlstate.h b/src/declarative/util/qmlstate.h
index 68c43fa..dd9d6ab 100644
--- a/src/declarative/util/qmlstate.h
+++ b/src/declarative/util/qmlstate.h
@@ -61,6 +61,7 @@ public:
Action();
QmlMetaProperty property;
+ bool restore;
QVariant fromValue;
QVariant toValue;
QString fromBinding;