Raajesh
17th June 2008, 14:18
I have a console based app code is like this,
#include <QApplication>
#include <iostream>
using namespace std;
class dummy : public QObject
{
Q_OBJECT
public:
void callme()
{
cout <<"callme()";
emit taskCompleted();
}
signals:
void taskCompleted();
};
#include "main.moc"
int main(int argc, char *argv[])
{
QApplication myapp(argc,argv);
dummy me;
QObject::connect (&me,SIGNAL(taskCompleted()),&myapp,SLOT(quit()));
me.callme();
return myapp.exec();
}
It never makes clean exit, it just hangs. once taskCompleted is emitted it should call quit and make clean exit. Is it expected or am I wrong here ?? I have to press ctrl+c to exit.
thanks,
Raajesh
#include <QApplication>
#include <iostream>
using namespace std;
class dummy : public QObject
{
Q_OBJECT
public:
void callme()
{
cout <<"callme()";
emit taskCompleted();
}
signals:
void taskCompleted();
};
#include "main.moc"
int main(int argc, char *argv[])
{
QApplication myapp(argc,argv);
dummy me;
QObject::connect (&me,SIGNAL(taskCompleted()),&myapp,SLOT(quit()));
me.callme();
return myapp.exec();
}
It never makes clean exit, it just hangs. once taskCompleted is emitted it should call quit and make clean exit. Is it expected or am I wrong here ?? I have to press ctrl+c to exit.
thanks,
Raajesh