Browse Source

分诊TEXT居中

master
Bai 4 years ago
parent
commit
ff0ce16368
  1. 26
      QCPShow.pro.user
  2. 4
      main.cpp
  3. 27
      mainwidget.cpp
  4. 3
      mainwidget.h

26
QCPShow.pro.user

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.2.1, 2021-10-21T17:16:06. -->
<!-- Written by QtCreator 4.2.1, 2021-10-21T21:53:19. -->
<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>
@ -285,14 +285,14 @@
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">QCPShow</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:E:/Qt/QtSpace/QCPShow/QCPShow.pro</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">QCPShow2</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>

4
main.cpp

@ -43,8 +43,8 @@ int main(int argc, char *argv[])
QObject::connect(&w,&MainWidget::statusChanged,&httpService,&HttpService::updateStatus);
QObject::connect(&w,&MainWidget::complexOneKeyStart,&httpService,&HttpService::onComplexOneKeyStart);
w.show();
// w.showFullScreen();
// w.show();
w.showFullScreen();
return a.exec();
}

27
mainwidget.cpp

@ -37,6 +37,7 @@ MainWidget::MainWidget(QWidget *parent) :
m_patientIndex = 0;
}
updateUi();
m_curX = 0;
});
//显示连接状态
@ -56,6 +57,7 @@ MainWidget::MainWidget(QWidget *parent) :
// ui->countdownLabel->setAlignment(Qt::AlignHCenter);
// ui->statusLabel->setAlignment(Qt::AlignRight);
isFenzhen = false;
m_curX = 0;
connect(&m_lableScrollTimer,SIGNAL(timeout()),this,SLOT(lableScrollDisplay()));
m_lableScrollTimer.start(10);
@ -68,7 +70,7 @@ MainWidget::~MainWidget()
void MainWidget::updateUi()
{
m_curX = 0;//内容超出显示区域时,更新患者信息显示从头开始滚动
// m_curX = 0;//内容超出显示区域时,更新患者信息显示从头开始滚动
//更新statusLabel
// ui->statusLabel->setText(QString("%1 | %2")
@ -102,6 +104,7 @@ void MainWidget::updateUi()
QString str = "";
if(pInfo->realCountDownInSeconds < 0){
str = "";
isFenzhen = true;
}else{
int hour,min,sec,nTotalSecs;
nTotalSecs = pInfo->realCountDownInSeconds;
@ -130,7 +133,7 @@ void MainWidget::resizeEvent(QResizeEvent *event)
QWidget::resizeEvent(event);
//标题
// ui->textLabel->setGeometry(0,0,this->width(),(this->height()-30)/2);
// 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);
@ -138,20 +141,30 @@ void MainWidget::resizeEvent(QResizeEvent *event)
void MainWidget::lableScrollDisplay()
{
// qDebug()<<"m_curX = "<<m_curX;
if(m_patientEmergencyInfos.length() == 0){
return;
}
QFontMetrics fm(font1);
m_width = fm.width(ui->textLabel->text());
m_height = ui->textLabel->height();
if(isFenzhen){
m_y = (this->height()-m_height)/2;
}
else{
int m_y = 0;
}
if(this->width() > m_width){
ui->textLabel->setGeometry((this->width()-m_width)/2, 0,m_width,(this->height()-30)/2);
ui->textLabel->setGeometry((this->width()-m_width)/2, m_y,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_curX;
ui->textLabel->setGeometry(150-m_curX*3,m_y,m_width,(this->height()-30)/2);
}
if(m_curX > (m_width - this->width())){
if(m_curX > m_width){
m_curX = 0;
}
}
void MainWidget::onWsConnectedStatusChanged(int status)

3
mainwidget.h

@ -31,7 +31,8 @@ private:
int m_wsConnectedStatus;
QFont font1, font2, font3;
QTimer m_lableScrollTimer;
int m_width, m_curX;
int m_width, m_height, m_curX, m_y;
bool isFenzhen;
public slots:
void updateUi();

Loading…
Cancel
Save