diff options
-rw-r--r-- | src/corelib/statemachine/qhistorystate.cpp | 28 | ||||
-rw-r--r-- | src/corelib/statemachine/qhistorystate.h | 16 |
2 files changed, 40 insertions, 4 deletions
diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp index 65ac2a77a0..1706d86afd 100644 --- a/src/corelib/statemachine/qhistorystate.cpp +++ b/src/corelib/statemachine/qhistorystate.cpp @@ -181,7 +181,10 @@ void QHistoryState::setDefaultState(QAbstractState *state) "to this history state's group (%p)", state, parentState()); return; } - d->defaultState = state; + if (d->defaultState != state) { + d->defaultState = state; + emit defaultStateChanged(QHistoryState::QPrivateSignal()); + } } /*! @@ -199,7 +202,10 @@ QHistoryState::HistoryType QHistoryState::historyType() const void QHistoryState::setHistoryType(HistoryType type) { Q_D(QHistoryState); - d->historyType = type; + if (d->historyType != type) { + d->historyType = type; + emit historyTypeChanged(QHistoryState::QPrivateSignal()); + } } /*! @@ -226,6 +232,24 @@ bool QHistoryState::event(QEvent *e) return QAbstractState::event(e); } +/*! + \fn QHistoryState::defaultStateChanged() + \since 5.4 + + This signal is emitted when the defaultState property is changed. + + \sa QHistoryState::defaultState +*/ + +/*! + \fn QHistoryState::historyTypeChanged() + \since 5.4 + + This signal is emitted when the historyType property is changed. + + \sa QHistoryState::historyType +*/ + QT_END_NAMESPACE #endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qhistorystate.h b/src/corelib/statemachine/qhistorystate.h index 62278ac47a..024c7e4b1f 100644 --- a/src/corelib/statemachine/qhistorystate.h +++ b/src/corelib/statemachine/qhistorystate.h @@ -53,8 +53,8 @@ class QHistoryStatePrivate; class Q_CORE_EXPORT QHistoryState : public QAbstractState { Q_OBJECT - Q_PROPERTY(QAbstractState* defaultState READ defaultState WRITE setDefaultState) - Q_PROPERTY(HistoryType historyType READ historyType WRITE setHistoryType) + Q_PROPERTY(QAbstractState* defaultState READ defaultState WRITE setDefaultState NOTIFY defaultStateChanged) + Q_PROPERTY(HistoryType historyType READ historyType WRITE setHistoryType NOTIFY historyTypeChanged) Q_ENUMS(HistoryType) public: enum HistoryType { @@ -72,6 +72,18 @@ public: HistoryType historyType() const; void setHistoryType(HistoryType type); +Q_SIGNALS: + void defaultStateChanged( +#if !defined(Q_QDOC) + QPrivateSignal +#endif + ); + void historyTypeChanged( +#if !defined(Q_QDOC) + QPrivateSignal +#endif + ); + protected: void onEntry(QEvent *event); void onExit(QEvent *event); |