Using QMetaObject::invokeMethod() doesn't work
I'm trying to make my first QMetaObject::invokeMethod() call, but it doesn't work.
Here is what I'm doing:
Code:
int main(int argc, char *argv[])
{
MainProcess *p = new MainProcess();
p->slotStart();
bool bValue
= QMetaObject::invokeMethod(p,
"slotStart", Qt
::DirectConnection);
// QueuedConnection);
return app.exec();
}
The p->slotStart() calls the method just fine, but the invokeMethod() returns false.
Any ideas?
- BRC
Re: Using QMetaObject::invokeMethod() doesn't work
Quote:
Originally Posted by
bruccutler
Any ideas?
Let's start with the simple ones:
- slotStart is actually a slot?
- MainProcess is a QObject?
- MainProcess contains the Q_OBJECT macro?
If you can answer all these questions with yes, we might have to digg deeper ;-)
Re: Using QMetaObject::invokeMethod() doesn't work
No - slotStart was not a slot. I had forgotten to include Q_OBJECT in the header file. Oops - I've done that too many times when I create a new class.
Thanks for your help.
- BRC