[Qt-interest] problem using QThread
Sarvesh Saran
Sarvesh.Saran at synopsys.com
Wed May 20 16:09:23 CEST 2009
Hi,
I have a main window where one of its widgets launches a QThread. Unfortunately an exit(1) in the thread closes the main window too. I'm not sure why this is happening. It could be because of the way I launch the thread or something else.
Basically, I am doing the following:
1. (in mainwindow.cpp)
Mywidget *widget = new Mywidget(this);
2. .....then in MyWidget.cpp
MyThread *th = new MyThread(this);
Connect (this,SIGNAL(killall()),th,SLOT(KillThread()));
th->start();
And ..
on_killButton_clicked()
{
Killall();
}
3. Finally in mythread.cpp
KillThread()
{
exit(1);
}
Unfortunately slot KillThread causes the mainwindow to exit out.
Is there something I am missing?
Thanks,
Sarvesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090520/8e0b7adc/attachment.html
More information about the Qt-interest-old
mailing list