Widget::Widget(QWidget *parent) : QWidget (parent) , view_ (new QTableView(this)) , data_generator_(new data_generator(this)) , model_ (new QStandardItemModel()) , thread_ (new QThread()){ view_->setModel(model_); connect(data_generator_, SIGNAL(data(double)), model_, SLOT(on_data(double))); model_->moveToThread(thread_); thread_->start();}Widget::~Widget(){ thread_->quit(); thread_->wait(); delete model_; delete thread_;}
Widget::Widget(QWidget *parent) : QWidget (parent) , view_ (new QTableView(this)) , data_generator_(new data_generator(this)) , proxy_model_ (new QSortFilterProxyModel(this)) , model_ (new QStandardItemModel()) , thread_ (new QThread()){ connect(data_generator_, SIGNAL(data(double)), model_, SLOT(on_data(double))); proxy_model_->setSourceModel(model_); view_->setModel(proxy_model_); model_->moveToThread(thread_); thread_->start();}Widget::~Widget(){ thread_->quit(); thread_->wait(); delete model_; delete thread_;}