diff options
Diffstat (limited to 'doc/src/frameworks-technologies')
-rw-r--r-- | doc/src/frameworks-technologies/containers.qdoc | 5 | ||||
-rw-r--r-- | doc/src/frameworks-technologies/statemachine.qdoc | 35 |
2 files changed, 36 insertions, 4 deletions
diff --git a/doc/src/frameworks-technologies/containers.qdoc b/doc/src/frameworks-technologies/containers.qdoc index d29ca0e..0ac9732 100644 --- a/doc/src/frameworks-technologies/containers.qdoc +++ b/doc/src/frameworks-technologies/containers.qdoc @@ -267,7 +267,10 @@ Iterators provide a uniform means to access items in a container. Qt's container classes provide two types of iterators: Java-style - iterators and STL-style iterators. + iterators and STL-style iterators. Iterators of both types are + invalidated when the data in the container is modified or detached + from \l{Implicit Sharing}{implicitly shared copies} due to a call + to a non-const member function. \section2 Java-Style Iterators diff --git a/doc/src/frameworks-technologies/statemachine.qdoc b/doc/src/frameworks-technologies/statemachine.qdoc index 904b551..ed8bc85 100644 --- a/doc/src/frameworks-technologies/statemachine.qdoc +++ b/doc/src/frameworks-technologies/statemachine.qdoc @@ -304,13 +304,42 @@ For parallel state groups, the QState::finished() signal is emitted when \e all the child states have entered final states. + \section1 Targetless Transitions + + A transition need not have a target state. A transition without a target can + be triggered the same way as any other transition; the difference is that + when a targetless transition is triggered, it doesn't cause any state + changes. This allows you to react to a signal or event when your machine is + in a certain state, without having to leave that state. Example: + + \code + QStateMachine machine; + QState *s1 = new QState(&machine); + + QPushButton button; + QSignalTransition *trans = new QSignalTransition(&button, SIGNAL(clicked())); + s1->addTransition(trans); + + QMessageBox msgBox; + msgBox.setText("The button was clicked; carry on."); + QObject::connect(trans, SIGNAL(triggered()), &msgBox, SLOT(exec())); + + machine.setInitialState(s1); + \endcode + + The message box will be displayed each time the button is clicked, but the + state machine will remain in its current state (s1). If the target state + were explicitly set to s1, however, s1 would be exited and re-entered each + time (e.g. the QAbstractState::entered() and QAbstractState::exited() + signals would be emitted). + \section1 Events, Transitions and Guards A QStateMachine runs its own event loop. For signal transitions (QSignalTransition objects), QStateMachine automatically posts a - QSignalEvent to itself when it intercepts the corresponding signal; - similarly, for QObject event transitions (QEventTransition objects) a - QWrappedEvent is posted. + QStateMachine::SignalEvent to itself when it intercepts the corresponding + signal; similarly, for QObject event transitions (QEventTransition objects) + a QStateMachine::WrappedEvent is posted. You can post your own events to the state machine using QStateMachine::postEvent(). |