Hello guys,
I'm learning QThread with a simple application ... my thread start with a modified Run() function.
in the run(), l activate a QDialog, do some stuff and wait with exec() for the user to click on QPushbutton "Keep" or "close"
Thread_PulseMeas
::Thread_PulseMeas(QObject *parent
):{
ui_RealTimePlot.setupUi(diag_RealTimePlot);
diag_RealTimePlot->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint);
connect(ui_RealTimePlot.Close, SIGNAL(clicked()), this, SLOT(Close()));
connect(ui_RealTimePlot.Add, SIGNAL(clicked()), this, SLOT(Add()));
};
void Thread_PulseMeas::run( Pulse_Meas *PulseMeas)
{
diag_RealTimePlot->show();
Pulse_measure(PulseMeas);
exec();
}
void Thread_PulseMeas::Close()
{
SetKeep(false);
diag_RealTimePlot->close();
exit();
}
void Thread_PulseMeas::Add()
{
SetKeep(true);
diag_RealTimePlot->close();
exit();
}
Thread_PulseMeas::Thread_PulseMeas(QObject *parent):
QThread(parent)
{
diag_RealTimePlot = new QDialog;
ui_RealTimePlot.setupUi(diag_RealTimePlot);
diag_RealTimePlot->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint);
connect(ui_RealTimePlot.Close, SIGNAL(clicked()), this, SLOT(Close()));
connect(ui_RealTimePlot.Add, SIGNAL(clicked()), this, SLOT(Add()));
};
void Thread_PulseMeas::run( Pulse_Meas *PulseMeas)
{
diag_RealTimePlot->show();
Pulse_measure(PulseMeas);
exec();
}
void Thread_PulseMeas::Close()
{
SetKeep(false);
diag_RealTimePlot->close();
exit();
}
void Thread_PulseMeas::Add()
{
SetKeep(true);
diag_RealTimePlot->close();
exit();
}
To copy to clipboard, switch view to plain text mode
when l click "keep" or "close", the QDIALOG is closed but the thread is not terminated ....
am l missing something there ?
regards,
Michael
Bookmarks