[Qt-interest] enum + QVariant + state machine

Tibo W tibo_wcc at yahoo.com
Sat Feb 12 02:20:26 CET 2011


Hi,

I have a QState A which communicates with a customState B using a QSignalTransition.
The QSignalTransition has a signal "appSelected(myEnum)".
In customState B, I can get the value of myEnum if I use Q_DECLARE_METATYPE(myEnum).

But, the first time I'll fire the signal, I'll get the value 0 (in the method onEntry of customState). But the next calls will return the correct value.
If I use an int instead of myEnum, I don't see this issue.

So I'm wondering if I use the enum / QVariant properly ?

My enum is in a common.h, and I use Q_DECLARE_METATYPE just before the definition of customState, and I get the value by doing signal.value<myEnum>().

I also tried qRegisterMetaType, but I got the same result.

Thanks for your help



 
____________________________________________________________________________________
Don't get soaked.  Take a quick peek at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110211/e66d8617/attachment.html 


More information about the Qt-interest-old mailing list