Edit: Solved.
Hi, I'm starting with Qt, I try to connect a slot to signal QProcess::started()
but can't. QObject::connect()
returns false
.
Any idea what am I doing wrong?
Here's part of the code:
class foo : public QObject
{
public:
QProcess *process;
public slots:
void process_started();
}
foo::foo()
{
process = new QProcess();
bool status = QObject::connect( process, SIGNAL( started() ), this, SLOT( process_started() ) );
// status is false, meaning the slot and signal couldn't be connected
}
I know the process starts successfully because I tried process->WaitForStarted()
and it returns true
.
But I put a breakpoint at the slot foo::process_started()
and it never gets hit.
What's the problem here?
Thanks!
You forgot to put Q_OBJECT
in your class declaration. Without that keyword, moc
doesn't know it needs to generate metaobject information for your class.