You can use the staticMetaObject for that.
class Test : public QObject
{
Q_OBJECT
public:
explicit Test(QObject *parent = 0) :
QObject(parent)
{
for (int n = 0; n < staticMetaObject.methodCount(); n++) {
functions.append(QString::fromLocal8Bit(staticMetaObject.method(n).name()));
}
qDebug() << functions;
}
signals:
void testSignal();
private slots:
void privateTestFunction() {}
public slots:
void publicTestFunction() {}
private:
QStringList functions;
};
One condition, the functions need to be declared as slots or signal.
Output:
("destroyed","destroyed","objectNameChanged","deleteLater","_q_reregisterTimers",
"testSignal","privateTestFunction","publicTestFunction")