[Qt-interest] How to change QState when clicking a QListView

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Tue Aug 10 06:52:10 CEST 2010


>> and send the Event via
>> QCoreApplication::notify(),
>
> I could be wrong, but since your dealing with a state machine, it's
> probably more appropriate to use QStateMachine.postEvent().
> In somewhat compressed form:
>
>   stateMachine.postEvent (new ItemClickedEvent (index));
>

QStateMachine runs it's own event loop. So you are right, using
postEvent() is the only option to send events to the state machine
(sending it to the main threads event queue will not send it to the
state machine's event queue).

HTH,
-mandeep

> (For all I know, postEvent and notify may be equivalent, in that
> postEvent may resolve to notify under the hood.)




More information about the Qt-interest-old mailing list