[Qt-interest] the method "indexOfMethod" always return "-1", why?

J-P Nurmi jpnurmi at gmail.com
Sun Aug 16 17:26:34 CEST 2009


On Sun, Aug 16, 2009 at 6:10 PM, Yao Huiji<spideryao at gmail.com> wrote:
> Hi,
>
> sorry for my newbie question. when I call "indexOfMethod" ,the return value
> always is "-1",I don't konw why,can you help me?
>
>
> #include <QtCore/QCoreApplication>
>
> int main(int argc, char *argv[])
> {
>     QCoreApplication a(argc, argv);
>
>     QString
> str(QString("%1").arg(a.metaObject()->indexOfMethod("aboutToQuit")));
>
>     printf(str.toStdString().c_str());
>
>     return a.exec();
> }

>From docs: "Note that the method has to be in normalized form, as
returned by normalizedSignature()."

metaObject()->indexOfMethod("aboutToQuit()")

--
J-P Nurmi




More information about the Qt-interest-old mailing list