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

Thiago Macieira thiago.macieira at trolltech.com
Tue Aug 18 08:47:42 CEST 2009


Yao Huiji wrote:
>Hi,
>
>    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 ?

moc only extracts functions marked signal, slot or otherwise invokable. 
Normal functions are not extracted, so SayHi won't appear in the meta 
object.

If you want it extracted, add the Q_INVOKABLE prefix to it.

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Development Frameworks
     Sandakerveien 116, NO-0402 Oslo, Norway

Qt Developer Days 2009 | Registration Now Open!
Munich, Germany: Oct 12 - 14     San Francisco, California: Nov 2 - 4
      http://qt.nokia.com/qtdevdays2009
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090818/52138557/attachment.bin 


More information about the Qt-interest-old mailing list