Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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() << m.name();
    }
    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

    Thanks


  • Lifetime Qt Champion

    Hi,

    What is the complete signature of testSlot ?


Log in to reply