[Qt-interest] How to change QState when clicking a QListView
Mandeep Sandhu
mandeepsandhu.chd at gmail.com
Fri Aug 6 14:49:52 CEST 2010
Since you are only passing the QModelindex around, I assume you'll
have access to the model in your 'playerState'.
> My problem is that I can :
>
> - add a transition to the 'playerState' using the QState::addTransition (
> QObject * sender, const char * signal, QAbstractState * target ) method
> with the clicked signal,
In this case you can probably find out what selection was made by
inspecting QItemSelectionModel got from your model.
You can try QItemSelectionModel::currentIndex() (not sure if this will
work since I haven't tried it myself).
>
> - OR retrieve the QModelIndex representing the clicked item using a basic
> SIGNAL/SLOT connection.
In this case you can also post a custom event to your state machine
which causes it to transition to the 'playerState' (little more
cumbersome than the previous approach since you'd have to write your
own custom transition as well).
HTH,
-mandeep
>
> But I'd need both (retrieve the clicked item + go to the targeted state).
>
> I tried several things to do that without success (I can describe them if
> you want, or even post code).
>
> Is there a way to do that ? What am I missing ?
>
> Thanks a lot for your help,
>
> --
> François
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
More information about the Qt-interest-old
mailing list