Ahmed Abdellatif
14th October 2017, 12:37
I have a problem with assigning a parent to the thread in the constructor of the dialog constructor:
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
thread_ptr=new Mythread(this); // <------------ here is the problem
connect(thread_ptr,SIGNAL(valueChanged(int)),this, SLOT(On_value_changed(int)));
}
The error as follows:
error: no matching function for call to 'Mythread::Mythread(Dialog*)'
thread_ptr=new Mythread(this);
^
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
thread_ptr=new Mythread(this); // <------------ here is the problem
connect(thread_ptr,SIGNAL(valueChanged(int)),this, SLOT(On_value_changed(int)));
}
The error as follows:
error: no matching function for call to 'Mythread::Mythread(Dialog*)'
thread_ptr=new Mythread(this);
^