[Qt-interest] "indexOfMethod" always return -1 if it's parameter is not a slot or sigal, why

Andre Somers andre at familiesomers.nl
Tue Aug 18 09:15:52 CEST 2009


Yao Huiji wrote:
>  In my class , there is a normal method named "SayHi", when I call 
> "indexOfMethod" ,the return value is -1, but after I use "signals" or 
> "slots" to modify this method , it will return the right method index. 
> I don't know why ?
>  
Because this is a function of the Qt meta-object system, and that only 
works for classes that:
1) inherit QObject, and
2) use the Q_OBJECT macro in the class definition, and
3) is only available for methods that are invokable: signals, slots, and 
every method you use the Q_INVOKABLE macro on

Qt adds extra functionality to standard C++, but it does not change 
normal C++.

André



More information about the Qt-interest-old mailing list