summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-11-19 04:18:53 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-11-19 04:18:53 (GMT)
commitaab933d997a303f22864f8c1d843f6882a38d496 (patch)
tree0897fdb1f6ccd2a2c0562320aa1ae7efaad87fb5
parentd4e35bced214119c7d825eb9d3bd76c1114934ba (diff)
downloadQt-aab933d997a303f22864f8c1d843f6882a38d496.zip
Qt-aab933d997a303f22864f8c1d843f6882a38d496.tar.gz
Qt-aab933d997a303f22864f8c1d843f6882a38d496.tar.bz2
Remove deleted states from the StateGroup.
-rw-r--r--src/declarative/util/qmlstate.cpp3
-rw-r--r--src/declarative/util/qmlstategroup.cpp9
-rw-r--r--src/declarative/util/qmlstategroup_p.h1
3 files changed, 13 insertions, 0 deletions
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index c05c539..5fde89a 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -161,6 +161,9 @@ QmlState::QmlState(QObject *parent)
QmlState::~QmlState()
{
+ Q_D(QmlState);
+ if (d->group)
+ d->group->removeState(this);
}
/*!
diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp
index 506ab82..d6ce191 100644
--- a/src/declarative/util/qmlstategroup.cpp
+++ b/src/declarative/util/qmlstategroup.cpp
@@ -119,6 +119,9 @@ QmlStateGroup::QmlStateGroup(QObject *parent)
QmlStateGroup::~QmlStateGroup()
{
+ Q_D(const QmlStateGroup);
+ for (int i = 0; i < d->states.count(); ++i)
+ d->states.at(i)->setStateGroup(0);
}
QList<QmlState *> QmlStateGroup::states() const
@@ -380,4 +383,10 @@ QmlState *QmlStateGroup::findState(const QString &name) const
return 0;
}
+void QmlStateGroup::removeState(QmlState *state)
+{
+ Q_D(QmlStateGroup);
+ d->states.removeOne(state);
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlstategroup_p.h b/src/declarative/util/qmlstategroup_p.h
index f4c6d86..ddd27d7 100644
--- a/src/declarative/util/qmlstategroup_p.h
+++ b/src/declarative/util/qmlstategroup_p.h
@@ -83,6 +83,7 @@ Q_SIGNALS:
private:
friend class QmlState;
void updateAutoState();
+ void removeState(QmlState *state);
};
QT_END_NAMESPACE