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

François KUBLER francois at kubler.org
Wed Aug 11 10:25:54 CEST 2010


Hi,

On Tue, 10 Aug 2010 10:22:10 +0530, Mandeep Sandhu
<mandeepsandhu.chd at gmail.com> wrote:
>>> 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
> 

As K. Frank stated, you'd probably don't need this. You'd just have to use
the QStateMachine::SignalEvent.
It worked very well in my case.

Thanks again for your answers, I was looking for this for days !
-- 
François



More information about the Qt-interest-old mailing list