12.7.  invokeMethod()

[ fromfile: invokemethod.xml id: invokemethod ]

Example 12.16. src/reflection/invokemethod/autosaver.cpp

void AutoSaver::saveIfNecessary() {
    if (!QMetaObject::invokeMethod(parent(), "save")) {
        qWarning() << "AutoSaver: error invoking save() on parent";
    }
}

Example 12.17. src/reflection/invokemethod/arguments.cpp

QByteArray buffer= ... ;
const bool b = QMetaObject::invokeMethod(m_thread, "calculateSpectrum",
                  Qt::AutoConnection,
                  Q_ARG(QByteArray, buffer),
                  Q_ARG(int, format.frequency()),
                  Q_ARG(int, bytesPerSample));