Emit a notifications when childMode, initial and errorState are changed.
In order to properly use QState object in QML we need to know when these properties are changed. Change-Id: I37f8295e5201686a52d448cc42db331a8f8e792f Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: BogDan Vatra <bogdan@kde.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
parent
7fa584254c
commit
dd70e2cb0f
@ -309,7 +309,10 @@ void QState::setErrorState(QAbstractState *state)
|
||||
return;
|
||||
}
|
||||
|
||||
d->errorState = state;
|
||||
if (d->errorState != state) {
|
||||
d->errorState = state;
|
||||
emit errorStateChanged(QState::QPrivateSignal());
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -491,7 +494,10 @@ void QState::setInitialState(QAbstractState *state)
|
||||
state, this);
|
||||
return;
|
||||
}
|
||||
d->initialState = state;
|
||||
if (d->initialState != state) {
|
||||
d->initialState = state;
|
||||
emit initialStateChanged(QState::QPrivateSignal());
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -509,7 +515,10 @@ QState::ChildMode QState::childMode() const
|
||||
void QState::setChildMode(ChildMode mode)
|
||||
{
|
||||
Q_D(QState);
|
||||
d->childMode = mode;
|
||||
if (d->childMode != mode) {
|
||||
d->childMode = mode;
|
||||
emit childModeChanged(QState::QPrivateSignal());
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -549,6 +558,33 @@ bool QState::event(QEvent *e)
|
||||
\sa QState::assignProperty(), QAbstractTransition::addAnimation()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QState::childModeChanged()
|
||||
\since 5.4
|
||||
|
||||
This signal is emitted when the childMode property is changed.
|
||||
|
||||
\sa QState::childMode
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QState::initialStateChanged()
|
||||
\since 5.4
|
||||
|
||||
This signal is emitted when the initialState property is changed.
|
||||
|
||||
\sa QState::initialState
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QState::errorStateChanged()
|
||||
\since 5.4
|
||||
|
||||
This signal is emitted when the errorState property is changed.
|
||||
|
||||
\sa QState::errorState
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif //QT_NO_STATEMACHINE
|
||||
|
@ -58,9 +58,9 @@ class QStatePrivate;
|
||||
class Q_CORE_EXPORT QState : public QAbstractState
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QAbstractState* initialState READ initialState WRITE setInitialState)
|
||||
Q_PROPERTY(QAbstractState* errorState READ errorState WRITE setErrorState)
|
||||
Q_PROPERTY(ChildMode childMode READ childMode WRITE setChildMode)
|
||||
Q_PROPERTY(QAbstractState* initialState READ initialState WRITE setInitialState NOTIFY initialStateChanged)
|
||||
Q_PROPERTY(QAbstractState* errorState READ errorState WRITE setErrorState NOTIFY errorStateChanged)
|
||||
Q_PROPERTY(ChildMode childMode READ childMode WRITE setChildMode NOTIFY childModeChanged)
|
||||
Q_ENUMS(ChildMode RestorePolicy)
|
||||
public:
|
||||
enum ChildMode {
|
||||
@ -106,6 +106,21 @@ Q_SIGNALS:
|
||||
void propertiesAssigned(
|
||||
#if !defined(Q_QDOC)
|
||||
QPrivateSignal
|
||||
#endif
|
||||
);
|
||||
void childModeChanged(
|
||||
#if !defined(Q_QDOC)
|
||||
QPrivateSignal
|
||||
#endif
|
||||
);
|
||||
void initialStateChanged(
|
||||
#if !defined(Q_QDOC)
|
||||
QPrivateSignal
|
||||
#endif
|
||||
);
|
||||
void errorStateChanged(
|
||||
#if !defined(Q_QDOC)
|
||||
QPrivateSignal
|
||||
#endif
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user