my testcase:
Qt Code:
  1. class test : public QObject
  2. {
  3. Q_OBJECT
  4. public slots:
  5. void foo() {
  6. qDebug() << "foo called";
  7. }
  8. };
  9.  
  10. int main(int argc, char** argv)
  11. {
  12. QApplication app(argc,argv);
  13. test* x = new test;
  14. x->foo(); //works
  15. QTimer::singleShot(0, x, SLOT(foo())); //works
  16. QMetaObject::invokeMethod(x, SLOT(foo())); //doesn't work
  17. app.exec();
  18. }
  19. #include "main.moc"
To copy to clipboard, switch view to plain text mode 

what's wrong? Why doesn't this work? (invoceMethod returns false - which means that the method is not found)

thanks,
niko