MsgBufferModel::MsgBufferModel(QObject *parent) :QAbstractTableModel(parent) { /* Object Variables. */ lastValue = 0; /* GUI Refresh. */ timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(timerHit())); timer->start(1000); /* Monitor Threads. */ QThread *threadx = new QThread; Monitor *monitor = new Monitor; connect(monitor, SIGNAL(messageInBuffer(canMessage*)), this, SLOT(newMsg(canMessage*))); connect(this, SIGNAL(start()), monitor, SLOT(start())); connect(this, SIGNAL(stop()), monitor, SLOT(stop())); monitor->moveToThread(threadx); threadx->start(); emit start(); }
MyModel::MyModel(QObject *parent) :QAbstractTableModel(parent) { timer = new QTimer(this); timer->setInterval(1000); connect(timer, SIGNAL(timeout()) , this, SLOT(timerHit())); timer->start(); nRows = ROWS; m_gridData.resize(nRows); }
//! [quoting mymodel_a] MyModel::MyModel(QObject *parent) :QAbstractTableModel(parent) { // selectedCell = 0; timer = new QTimer(this); timer->setInterval(1000); connect(timer, SIGNAL(timeout()) , this, SLOT(timerHit())); timer->start(); }