diff --git a/QCPShow.pro.user b/QCPShow.pro.user index d46a439..0302d36 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/mainwidget.cpp b/mainwidget.cpp index d0f7c4b..391e64a 100644 --- a/mainwidget.cpp +++ b/mainwidget.cpp @@ -47,12 +47,9 @@ MainWidget::MainWidget(QWidget *parent) : 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::AlignVCenter); - ui->countdownLabel->setAlignment(Qt::AlignVCenter); - ui->statusLabel->setAlignment(Qt::AlignVCenter); +// ui->textLabel->setAlignment(Qt::AlignHCenter); +// ui->countdownLabel->setAlignment(Qt::AlignHCenter); +// ui->statusLabel->setAlignment(Qt::AlignRight); } MainWidget::~MainWidget() @@ -63,10 +60,16 @@ MainWidget::~MainWidget() void MainWidget::updateUi() { //更新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){ //不显示 @@ -112,7 +115,8 @@ void MainWidget::resizeEvent(QResizeEvent *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()-20,this->width(),20); + ui->LEDLabel->setGeometry(this->width()-120,this->height()-20,20,20); + ui->statusLabel->setGeometry(this->width()-80,this->height()-20,20,20); } void MainWidget::onWsConnectedStatusChanged(int status) diff --git a/mainwidget.ui b/mainwidget.ui index e7af632..3d243cc 100644 --- a/mainwidget.ui +++ b/mainwidget.ui @@ -25,11 +25,14 @@ textLabel + + Qt::AlignCenter + - 390 + 210 160 721 61 @@ -38,13 +41,16 @@ countdownLabel + + Qt::AlignCenter + - 870 + 950 390 - 231 + 151 21 @@ -56,6 +62,22 @@ statusLabel + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 790 + 400 + 54 + 12 + + + + TextLabel + 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