Browse Source

指示灯显示状态

pull/3/head
Bai 4 years ago
parent
commit
a863e3fe57
  1. 24
      QCPShow.pro.user
  2. BIN
      image/1LED_gray.png
  3. BIN
      image/1LED_green.png
  4. 26
      mainwidget.cpp
  5. 28
      mainwidget.ui
  6. 2
      resource.qrc

24
QCPShow.pro.user

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.2.1, 2021-10-19T16:47:12. -->
<!-- Written by QtCreator 4.2.1, 2021-10-20T17:07:05. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{fe03815e-74e2-457e-b60c-e66368cd4ce4}</value>
<value type="QByteArray">{0d351c1e-abb6-427c-8d0b-30ca23826ed5}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
@ -66,7 +66,7 @@
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/Qt/QtSpace/build-QcpShow-Desktop_Qt_5_8_0_MinGW_32bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/Qt/QtSpace/build-QcpShow-Desktop_Qt_5_8_0_MinGW_32bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -90,7 +90,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
@ -106,7 +106,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清理</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
@ -144,7 +144,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
@ -160,7 +160,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清理</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
@ -198,7 +198,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
@ -214,7 +214,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清理</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
@ -231,7 +231,7 @@
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
@ -286,13 +286,13 @@
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">QCPShow</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">QCPShow2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:E:/Qt/QtSpace/QCPShow/QCPShow.pro</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Qt/QtSpace/qt_qcp_show/QCPShow.pro</value>
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">QCPShow.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">E:/Qt/QtSpace/build-QcpShow-Desktop_Qt_5_8_0_MinGW_32bit-Debug</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">D:/Qt/QtSpace/build-QcpShow-Desktop_Qt_5_8_0_MinGW_32bit-Debug</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>

BIN
image/1LED_gray.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
image/1LED_green.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

26
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)

28
mainwidget.ui

@ -25,11 +25,14 @@
<property name="text">
<string>textLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="countdownLabel">
<property name="geometry">
<rect>
<x>390</x>
<x>210</x>
<y>160</y>
<width>721</width>
<height>61</height>
@ -38,13 +41,16 @@
<property name="text">
<string>countdownLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="statusLabel">
<property name="geometry">
<rect>
<x>870</x>
<x>950</x>
<y>390</y>
<width>231</width>
<width>151</width>
<height>21</height>
</rect>
</property>
@ -56,6 +62,22 @@
<property name="text">
<string>statusLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="LEDLabel">
<property name="geometry">
<rect>
<x>790</x>
<y>400</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>

2
resource.qrc

@ -2,5 +2,7 @@
<qresource prefix="/">
<file>image/header.png</file>
<file>image/black_bg.jpg</file>
<file>image/1LED_gray.png</file>
<file>image/1LED_green.png</file>
</qresource>
</RCC>

Loading…
Cancel
Save