summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-10-29 09:34:37 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-10-29 09:34:37 (GMT)
commit2f5a5804fb42a4c956f366d002a94076d6623a45 (patch)
treecf78d26f0c804d3d26c723784629440453c26246 /src/corelib
parentffe49ed60c9ee778b9999ee4145b44851b053f9f (diff)
parentf425c08d4f2e7f061a0ee8e4a1eee2b17fa64962 (diff)
downloadQt-2f5a5804fb42a4c956f366d002a94076d6623a45.zip
Qt-2f5a5804fb42a4c956f366d002a94076d6623a45.tar.gz
Qt-2f5a5804fb42a4c956f366d002a94076d6623a45.tar.bz2
Merge branch '4.6' into core-4.6
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/statemachine/qstate.cpp23
-rw-r--r--src/corelib/statemachine/qstate_p.h2
2 files changed, 17 insertions, 8 deletions
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index a6e4a57..9abf20b 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -124,7 +124,8 @@ QT_BEGIN_NAMESPACE
*/
QStatePrivate::QStatePrivate()
- : errorState(0), initialState(0), childMode(QState::ExclusiveStates)
+ : errorState(0), initialState(0), childMode(QState::ExclusiveStates),
+ transitionsListNeedsRefresh(true)
{
}
@@ -205,14 +206,17 @@ QList<QHistoryState*> QStatePrivate::historyStates() const
QList<QAbstractTransition*> QStatePrivate::transitions() const
{
- QList<QAbstractTransition*> result;
- QList<QObject*>::const_iterator it;
- for (it = children.constBegin(); it != children.constEnd(); ++it) {
- QAbstractTransition *t = qobject_cast<QAbstractTransition*>(*it);
- if (t)
- result.append(t);
+ if (transitionsListNeedsRefresh) {
+ transitionsList.clear();
+ QList<QObject*>::const_iterator it;
+ for (it = children.constBegin(); it != children.constEnd(); ++it) {
+ QAbstractTransition *t = qobject_cast<QAbstractTransition*>(*it);
+ if (t)
+ transitionsList.append(t);
+ }
+ transitionsListNeedsRefresh = false;
}
- return result;
+ return transitionsList;
}
#ifndef QT_NO_PROPERTIES
@@ -468,6 +472,9 @@ void QState::setChildMode(ChildMode mode)
*/
bool QState::event(QEvent *e)
{
+ Q_D(QState);
+ if ((e->type() == QEvent::ChildAdded) || (e->type() == QEvent::ChildRemoved))
+ d->transitionsListNeedsRefresh = true;
return QAbstractState::event(e);
}
diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h
index 20cda29..3b5f416 100644
--- a/src/corelib/statemachine/qstate_p.h
+++ b/src/corelib/statemachine/qstate_p.h
@@ -99,6 +99,8 @@ public:
QAbstractState *errorState;
QAbstractState *initialState;
QState::ChildMode childMode;
+ mutable bool transitionsListNeedsRefresh;
+ mutable QList<QAbstractTransition*> transitionsList;
QList<QPropertyAssignment> propertyAssignments;
};