How to use QMetaObject::invokeMethod?
my testcase:
Code:
{
Q_OBJECT
public slots:
void foo() {
qDebug() << "foo called";
}
};
int main(int argc, char** 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
Re: How to use QMetaObject::invokeMethod?
Re: How to use QMetaObject::invokeMethod?
Try without the SLOT() macro.
Re: How to use QMetaObject::invokeMethod?
of course - it all is written in the docs :D