niko
26th January 2008, 14:42
my testcase:
class test : public QObject
{
Q_OBJECT
public slots:
void foo() {
qDebug() << "foo called";
}
};
int main(int argc, char** argv)
{
QApplication app(argc,argv);
test* x = new test;
x->foo(); //works
QTimer::singleShot(0, x, SLOT(foo())); //works
QMetaObject::invokeMethod(x, SLOT(foo())); //doesn't work
app.exec();
}
#include "main.moc"
what's wrong? Why doesn't this work? (invoceMethod returns false - which means that the method is not found)
thanks,
niko
class test : public QObject
{
Q_OBJECT
public slots:
void foo() {
qDebug() << "foo called";
}
};
int main(int argc, char** argv)
{
QApplication app(argc,argv);
test* x = new test;
x->foo(); //works
QTimer::singleShot(0, x, SLOT(foo())); //works
QMetaObject::invokeMethod(x, SLOT(foo())); //doesn't work
app.exec();
}
#include "main.moc"
what's wrong? Why doesn't this work? (invoceMethod returns false - which means that the method is not found)
thanks,
niko