Important: Please read the Qt Code of Conduct -

How to use indexOfMethod

  • Hi
    I am trying to use the indexOfMethod method in QMetaObject and am a little confused.
    Here is my code -
    const QMetaObject* metaObject = m_parent->metaObject();
    for (int i = 0; i < metaObject->methodCount(); ++i)
    QMetaMethod m = metaObject->method(i);
    qDebug() <<;
    int methodIndex = metaObject->indexOfMethod(QMetaObject::normalizedSignature("testSlot"));
    When the application is run I can see 'testSlot' is output by the debug call, however, indexOfMethod returns -1 meaning it was not found.

    What am I doing wrong?

    All help appreciated


  • Lifetime Qt Champion


    What is the complete signature of testSlot ?

Log in to reply