class Caller : public QObject{ Q_OBJECT private: QHash<int, int> ftrs; protected: bool add(int i, const char *slot) // use: add(i, SLOT(foo())) { int id = metaObject()->indexOfMethod(QMetaObject::normalizedSignature(slot+1)); if(id == -1) return false; ftrs[i] = id; return true; } virtual void defMethod() {} public: Caller(QObject *p = 0): QObject(p) {} bool call(int i) { if(ftrs.contains(i)) { qt_metacall(QMetaObject::InvokeMetaMethod, ftrs[i], 0); return true; } defMethod(); return false; } };