//控制死窗体
int width = this->geometry().width();
int height = this->geometry().height();
this->setFixedSize(width,height);
//定时器的使用
QTimer *serialReadTimer = new QTimer;
connect(serialReadTimer,SIGNAL(timeout()),this,SLOT(readSerial()));
serialReadTimer->start();
// set display color size
QBrush myBrush;
QPalette myPalette;
myBrush = QBrush(Qt::red,Qt::DiagCrossPattern);
myPalette.setBrush(QPalette::Text,myBrush);
ui->showDatabase->setPalette(myPalette);
ui->showDatabase->setFont(QFont("Timers",));
//qSqlTableModel tableView的使用
model = new QSqlTableModel(this,db);
model->setTable("node");
//手动提交
model->setEditStrategy(QSqlTableModel::OnManualSubmit);
//修改tableView的列名
model->setHeaderData(,Qt::Orientation::Horizontal,"state");
model->select();
ui->showDatabase->setModel(model);
//根据内容自适应
ui->showDatabase->resizeColumnsToContents();
//hide header id
QHeaderView *headerView = ui->showDatabase->verticalHeader();
headerView->setHidden(true);
//关闭数据库
db.close();