diff --git a/QCPShow.pro.user b/QCPShow.pro.user index d46a439..d4f0342 100644 --- a/QCPShow.pro.user +++ b/QCPShow.pro.user @@ -1,10 +1,10 @@ - + EnvironmentId - {fe03815e-74e2-457e-b60c-e66368cd4ce4} + {0d351c1e-abb6-427c-8d0b-30ca23826ed5} ProjectExplorer.Project.ActiveTarget @@ -66,7 +66,7 @@ 0 0 - E:/Qt/QtSpace/build-QcpShow-Desktop_Qt_5_8_0_MinGW_32bit-Debug + D:/Qt/QtSpace/build-QcpShow-Desktop_Qt_5_8_0_MinGW_32bit-Debug true @@ -90,7 +90,7 @@ 2 - Build + 构建 ProjectExplorer.BuildSteps.Build @@ -106,7 +106,7 @@ 1 - Clean + 清理 ProjectExplorer.BuildSteps.Clean @@ -144,7 +144,7 @@ 2 - Build + 构建 ProjectExplorer.BuildSteps.Build @@ -160,7 +160,7 @@ 1 - Clean + 清理 ProjectExplorer.BuildSteps.Clean @@ -198,7 +198,7 @@ 2 - Build + 构建 ProjectExplorer.BuildSteps.Build @@ -214,7 +214,7 @@ 1 - Clean + 清理 ProjectExplorer.BuildSteps.Clean @@ -231,7 +231,7 @@ 0 - Deploy + 部署 ProjectExplorer.BuildSteps.Deploy @@ -286,13 +286,13 @@ QCPShow QCPShow2 - Qt4ProjectManager.Qt4RunConfiguration:E:/Qt/QtSpace/QCPShow/QCPShow.pro + Qt4ProjectManager.Qt4RunConfiguration:D:/Qt/QtSpace/qt_qcp_show/QCPShow.pro true QCPShow.pro false - E:/Qt/QtSpace/build-QcpShow-Desktop_Qt_5_8_0_MinGW_32bit-Debug + D:/Qt/QtSpace/build-QcpShow-Desktop_Qt_5_8_0_MinGW_32bit-Debug 3768 false true diff --git a/image/1LED_gray.png b/image/1LED_gray.png new file mode 100644 index 0000000..cd580f6 Binary files /dev/null and b/image/1LED_gray.png differ diff --git a/image/1LED_green.png b/image/1LED_green.png new file mode 100644 index 0000000..d2b005c Binary files /dev/null and b/image/1LED_green.png differ diff --git a/main.cpp b/main.cpp index 31d9c45..d5f10a2 100644 --- a/main.cpp +++ b/main.cpp @@ -25,11 +25,11 @@ int main(int argc, char *argv[]) //绑定信号与槽 QObject::connect(&websocketService,&WebsocketService::wsConnectedStatusChanged, - &w,MainWidget::onWsConnectedStatusChanged); + &w,&MainWidget::onWsConnectedStatusChanged); QObject::connect(&websocketService,&WebsocketService::newPatientMergencyInfo, - &w,MainWidget::onNewPatientMergencyInfo); + &w,&MainWidget::onNewPatientMergencyInfo); QObject::connect(&websocketService,&WebsocketService::patientMergencyStatusChanged, - &w,MainWidget::onPatientMergencyStatusChanged); + &w,&MainWidget::onPatientMergencyStatusChanged); QObject::connect(&w,&MainWidget::statusChanged,&httpService,&HttpService::updateStatus); diff --git a/mainwidget.cpp b/mainwidget.cpp index e0b2b41..08a9305 100644 --- a/mainwidget.cpp +++ b/mainwidget.cpp @@ -22,6 +22,7 @@ MainWidget::MainWidget(QWidget *parent) : info->realCountDownInSeconds--; } } + updateUi(); }); //切换病人 @@ -38,22 +39,22 @@ MainWidget::MainWidget(QWidget *parent) : ui->statusLabel->setText("Not Connected"); //显示设置 - QFont font1, font2; - font1.setPointSize(150); - font2.setPointSize(20); + font1.setPointSize(240); + font2.setPointSize(240); + font3.setPointSize(20); ui->textLabel->setFont(font1); - ui->countdownLabel->setFont(font1); - ui->statusLabel->setFont(font2); + ui->countdownLabel->setFont(font2); + ui->statusLabel->setFont(font3); ui->textLabel->setStyleSheet("QLabel {color: rgb(255,0,0);}");//设置文本红色 ui->countdownLabel->setStyleSheet("QLabel {color: rgb(255,0,0);}");//设置文本红色 ui->statusLabel->setStyleSheet("QLabel {color: rgb(85,255,0);}");//设置文本绿色 - ui->textLabel->setAlignment(Qt::AlignHCenter); - ui->countdownLabel->setAlignment(Qt::AlignHCenter); - ui->statusLabel->setAlignment(Qt::AlignRight); - ui->textLabel->setAlignment(Qt::AlignCenter); - ui->countdownLabel->setAlignment(Qt::AlignCenter); - ui->statusLabel->setAlignment(Qt::AlignCenter); +// ui->textLabel->setAlignment(Qt::AlignHCenter); +// ui->countdownLabel->setAlignment(Qt::AlignHCenter); +// ui->statusLabel->setAlignment(Qt::AlignRight); + m_curX = 0; + connect(&m_lableScrollTimer,SIGNAL(timeout()),this,SLOT(lableScrollDisplay())); + m_lableScrollTimer.start(10); } MainWidget::~MainWidget() @@ -63,11 +64,19 @@ MainWidget::~MainWidget() void MainWidget::updateUi() { + m_curX = 0;//内容超出显示区域时,更新患者信息显示从头开始滚动 + //更新statusLabel - ui->statusLabel->setText(QString("%1 | %2") - .arg(m_wsConnectedStatus == 0 ? "未连接" : "已连接") - .arg(m_patientEmergencyInfos.length()) - ); +// ui->statusLabel->setText(QString("%1 | %2") +// .arg(m_wsConnectedStatus == 0 ? "未连接" : "已连接") +// .arg(m_patientEmergencyInfos.length()) +// ); + if(m_wsConnectedStatus){ + ui->LEDLabel->setStyleSheet("border-image: url(:/image/1LED_green.png);"); + }else{ + ui->LEDLabel->setStyleSheet("border-image: url(::/image/1LED_gray.png);"); + } + ui->statusLabel->setText(QString::number(m_patientEmergencyInfos.length())); if(m_patientEmergencyInfos.length() == 0){ //不显示 @@ -89,7 +98,8 @@ void MainWidget::updateUi() int hour,min,sec,nTotalSecs; nTotalSecs = pInfo->realCountDownInSeconds; sec = nTotalSecs % 60; - min = nTotalSecs / 60 % 60; +// min = nTotalSecs / 60 % 60; + min = nTotalSecs / 60 ; //min显示大于60 hour = nTotalSecs / 3600; QString str = QString("%1:%2").arg(min,2,10,QLatin1Char('0')).arg(sec,2,10,QLatin1Char('0')); ui->countdownLabel->setText(str); @@ -111,9 +121,28 @@ void MainWidget::resizeEvent(QResizeEvent *event) QWidget::resizeEvent(event); //标题 - ui->textLabel->setGeometry(0,0,this->width(),(this->height()-20)/2); - ui->countdownLabel->setGeometry(0,(this->height()-20)/2,this->width(),(this->height()-20)/2); - ui->statusLabel->setGeometry(0,this->height()-16,this->width(),20); +// ui->textLabel->setGeometry(0,0,this->width(),(this->height()-30)/2); + ui->countdownLabel->setGeometry(0,(this->height()-30)/2,this->width(),(this->height()-30)/2); + ui->LEDLabel->setGeometry(this->width()-120,this->height()-30,20,30); + ui->statusLabel->setGeometry(this->width()-80,this->height()-30,20,30); +} + +void MainWidget::lableScrollDisplay() +{ + QFontMetrics fm(font1); + m_width = fm.width(ui->textLabel->text()); + if(this->width() > m_width){ + ui->textLabel->setGeometry((this->width()-m_width)/2, 0,m_width,(this->height()-30)/2); + } + else{ + m_curX ++; + ui->textLabel->setGeometry(20-m_curX,0,m_width,(this->height()-30)/2); +// qDebug()<<"move" < (m_width - this->width())){ + m_curX = 0; + } + } void MainWidget::onWsConnectedStatusChanged(int status) diff --git a/mainwidget.h b/mainwidget.h index e4d6280..4c7e2a2 100644 --- a/mainwidget.h +++ b/mainwidget.h @@ -28,6 +28,9 @@ private: QTimer m_countDownTimer; QTimer m_switchPatientTimer; int m_wsConnectedStatus; + QFont font1, font2, font3; + QTimer m_lableScrollTimer; + int m_width, m_curX; public slots: void updateUi(); @@ -36,9 +39,10 @@ public slots: void onPatientMergencyStatusChanged(QString firstAidId,QString time,QString status); void addPatientToList(PatientEmergencyInfo *); void deletePatientFromList(QString firstAidId); + void lableScrollDisplay(); signals: - statusChanged(QString firstAidId,QString status); + void statusChanged(QString firstAidId,QString status); }; #endif // MAINWIDGET_H diff --git a/mainwidget.ui b/mainwidget.ui index 7da9a5c..e86e9db 100644 --- a/mainwidget.ui +++ b/mainwidget.ui @@ -23,13 +23,16 @@ - textLabel + 传控科技优先做CT + + + Qt::AlignCenter - 390 + 210 160 721 61 @@ -38,14 +41,17 @@ countdownLabel + + Qt::AlignCenter + - 1010 + 950 390 - 91 - 20 + 151 + 21 @@ -56,6 +62,22 @@ statusLabel + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 790 + 400 + 54 + 12 + + + + + diff --git a/resource.qrc b/resource.qrc index de84d0a..f85b807 100644 --- a/resource.qrc +++ b/resource.qrc @@ -2,5 +2,7 @@ image/header.png image/black_bg.jpg + image/1LED_gray.png + image/1LED_green.png diff --git a/websocketservice.cpp b/websocketservice.cpp index 772a87d..a6b9a83 100644 --- a/websocketservice.cpp +++ b/websocketservice.cpp @@ -115,10 +115,11 @@ void WebsocketService::onTextMessageReceived(const QString &message) void WebsocketService::handleWsButtonStartMsg(QJsonObject jobj) { + qDebug()<