Device information timer event callback logic in tabform, update temperature and current time in state bar.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "tabformwidget.h"
|
||||
#include "ui_tabformwidget.h"
|
||||
#include <QDateTime>
|
||||
#include "event/EventCenter.h"
|
||||
TabFormWidget::TabFormWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::TabFormWidget)
|
||||
@@ -22,7 +23,8 @@ TabFormWidget::TabFormWidget(QWidget *parent) :
|
||||
QLabel* readyIcon = new QLabel(this);
|
||||
readyIcon->setPixmap(QPixmap(":/icons/ready.png").scaledToHeight(22,Qt::SmoothTransformation));
|
||||
QLabel* lockIcon = new QLabel(this);
|
||||
lockIcon->setPixmap(QPixmap(":/icons/lock.png").scaledToHeight(22,Qt::SmoothTransformation));
|
||||
lockIcon->setText("");
|
||||
// lockIcon->setPixmap(QPixmap(":/icons/lock.png").scaledToHeight(22,Qt::SmoothTransformation));
|
||||
QHBoxLayout* layout= new QHBoxLayout(ui->statusBarWidget);
|
||||
layout->setMargin(0);
|
||||
layout->addSpacerItem(new QSpacerItem(10,10,QSizePolicy::Expanding));
|
||||
@@ -36,6 +38,12 @@ TabFormWidget::TabFormWidget(QWidget *parent) :
|
||||
layout->addWidget(linkIcon);
|
||||
layout->addWidget(readyIcon);
|
||||
layout->addWidget(lockIcon);
|
||||
connect(EventCenter::Default(),&EventCenter::ResponseDeviceTemperature,[=](QObject*,QObject* msg){
|
||||
nowDate->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
|
||||
if (!msg) return;
|
||||
QString* s = (QString*)msg;
|
||||
lockIcon->setText(QString("%1%2").arg(*s).arg(QString::fromLocal8Bit("<EFBFBD><EFBFBD>C")));
|
||||
});
|
||||
}
|
||||
|
||||
TabFormWidget::~TabFormWidget()
|
||||
|
||||
Reference in New Issue
Block a user