Browse Source

2个api测试完成

pull/4/head
zhangsan 4 years ago
parent
commit
8d970ecff4
  1. 2
      QCPShow.pro
  2. 26
      QCPShow.pro.user
  3. 47
      api.http
  4. 4
      deviceservice.cpp
  5. 14
      httpservice.cpp
  6. 1
      httpservice.h
  7. 2
      main.cpp
  8. 2
      mainconfig.cpp
  9. 36
      mainwidget.cpp
  10. 4
      mainwidget.h
  11. 9
      resttest

2
QCPShow.pro

@ -68,4 +68,4 @@ RESOURCES += \
DISTFILES += \ DISTFILES += \
.gitignore \ .gitignore \
ReadMe.md \ ReadMe.md \
resttest api.http

26
QCPShow.pro.user

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

47
api.http

@ -0,0 +1,47 @@
GET https://example.com/comments/1 HTTP/1.1
###
GET https://example.com/topics/1 HTTP/1.1
###
# @name signin
POST http://test.tall.wiki/gateway/tall3/v3.0/users/signin HTTP/1.1
content-type: application/json
{
"client": 1,
"data": {
"credential": "123456",
"identifier": "shoufeichu"
},
"scene": 0,
"type": 3
}
###
POST https://test.tall.wiki/gateway/qcp/v3.0/button/idCardDiscern HTTP/1.1
content-type: application/json
Authorization: Bearer {{signin.response.body.$.data.token}}
{
"param":{
"idcard":"142733198703123919",
"name":"彭于晏",
"sex":"1",
"nation":"汉族"
}
}
###
POST https://test.tall.wiki/gateway/qcp/v3.0/button/buttonStart HTTP/1.1
content-type: application/json
Authorization: Bearer {{signin.response.body.$.data.token}}
{
"param":{
"idcard":"142733198703123919"
}
}

4
deviceservice.cpp

@ -70,8 +70,8 @@ quint8 DeviceService::keyReadOnce()
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
return digitalRead(WIRING_PIN_KEY); return digitalRead(WIRING_PIN_KEY);
#else #else
qDebug() << "keyReadOnce()"; //qDebug() << "keyReadOnce()";
return 0; return KEY_Up;
#endif #endif
} }

14
httpservice.cpp

@ -103,6 +103,7 @@ QByteArray HttpService::postJson(QUrl url,const QByteArray &json, quint32 timeou
result = reply->readAll(); result = reply->readAll();
} }
} }
qDebug() << result;
return result; return result;
} }
@ -114,7 +115,6 @@ void HttpService::login(QString username, QString password)
//发送请求 //发送请求
QByteArray result = postJson(MainConfig::loginUrl,json.toUtf8()); QByteArray result = postJson(MainConfig::loginUrl,json.toUtf8());
qDebug() << result;
//解析响应 //解析响应
QJsonParseError jerror; QJsonParseError jerror;
@ -144,7 +144,6 @@ void HttpService::updateStatus(QString firstAidId, QString status)
//发送请求 //发送请求
QByteArray result = postJson(MainConfig::serviceStatusChangedUrl,json.toUtf8()); QByteArray result = postJson(MainConfig::serviceStatusChangedUrl,json.toUtf8());
qDebug() << result;
//解析响应 //解析响应
QJsonParseError jerror; QJsonParseError jerror;
@ -173,7 +172,6 @@ void HttpService::sendIdcardInfo(QString idcard,QString name, QString sex, QStri
//发送请求 //发送请求
QByteArray result = postJson(MainConfig::sendUserInfoUrl,json.toUtf8()); QByteArray result = postJson(MainConfig::sendUserInfoUrl,json.toUtf8());
qDebug() << result;
//解析响应 //解析响应
QJsonParseError jerror; QJsonParseError jerror;
@ -201,8 +199,7 @@ void HttpService::oneKeyStart(QString idcard)
QString json = rawJson.arg(idcard); QString json = rawJson.arg(idcard);
//发送请求 //发送请求
QByteArray result = postJson(MainConfig::sendUserInfoUrl,json.toUtf8()); QByteArray result = postJson(MainConfig::oneKeyStartUrl,json.toUtf8());
qDebug() << result;
//解析响应 //解析响应
QJsonParseError jerror; QJsonParseError jerror;
@ -222,3 +219,10 @@ void HttpService::oneKeyStart(QString idcard)
qDebug() << "oneKeyStart失败:" << resCode; qDebug() << "oneKeyStart失败:" << resCode;
} }
} }
void HttpService::onComplexOneKeyStart(QString idcard, QString name, QString sex, QString nation)
{
qDebug() << "onComplexOneKeyStart" << idcard << name << sex << nation;
sendIdcardInfo(idcard,name,sex,nation);
oneKeyStart(idcard);
}

1
httpservice.h

@ -21,6 +21,7 @@ public slots:
void updateStatus(QString firstAidId,QString status); void updateStatus(QString firstAidId,QString status);
void sendIdcardInfo(QString idcard,QString name,QString sex,QString nation); void sendIdcardInfo(QString idcard,QString name,QString sex,QString nation);
void oneKeyStart(QString idcard); void oneKeyStart(QString idcard);
void onComplexOneKeyStart(QString idcard,QString name,QString sex,QString nation);
}; };
#endif // HTTPSERVICE_H #endif // HTTPSERVICE_H

2
main.cpp

@ -38,7 +38,7 @@ int main(int argc, char *argv[])
&w,&MainWidget::onKeyClicked); &w,&MainWidget::onKeyClicked);
QObject::connect(&w,&MainWidget::statusChanged,&httpService,&HttpService::updateStatus); QObject::connect(&w,&MainWidget::statusChanged,&httpService,&HttpService::updateStatus);
QObject::connect(&w,&MainWidget::complexOneKeyStart,&httpService,&HttpService::onComplexOneKeyStart);
w.show(); w.show();
// w.showFullScreen(); // w.showFullScreen();

2
mainconfig.cpp

@ -5,7 +5,7 @@
#define D_CONFIG_FILE_PATH "./setting.ini" #define D_CONFIG_FILE_PATH "./setting.ini"
QString MainConfig::token = ""; QString MainConfig::token = "";
QString MainConfig::username = "shoufeichu"; QString MainConfig::username = "fenzhentai";
QString MainConfig::password = "123456"; QString MainConfig::password = "123456";
QString MainConfig::loginUrl = "http://test.tall.wiki/gateway/tall3/v3.0/users/signin"; QString MainConfig::loginUrl = "http://test.tall.wiki/gateway/tall3/v3.0/users/signin";
QString MainConfig::sendUserInfoUrl = "https://test.tall.wiki/gateway/qcp/v3.0/button/idCardDiscern"; QString MainConfig::sendUserInfoUrl = "https://test.tall.wiki/gateway/qcp/v3.0/button/idCardDiscern";

36
mainwidget.cpp

@ -3,6 +3,8 @@
#include <QtCore> #include <QtCore>
#include "mainconfig.h" #include "mainconfig.h"
#define FIXEDIDCARD ""
MainWidget::MainWidget(QWidget *parent) : MainWidget::MainWidget(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::MainWidget) ui(new Ui::MainWidget)
@ -48,9 +50,9 @@ MainWidget::MainWidget(QWidget *parent) :
ui->textLabel->setStyleSheet("QLabel {color: rgb(255,0,0);}");//设置文本红色 ui->textLabel->setStyleSheet("QLabel {color: rgb(255,0,0);}");//设置文本红色
ui->countdownLabel->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->statusLabel->setStyleSheet("QLabel {color: rgb(85,255,0);}");//设置文本绿色
// ui->textLabel->setAlignment(Qt::AlignHCenter); // ui->textLabel->setAlignment(Qt::AlignHCenter);
// ui->countdownLabel->setAlignment(Qt::AlignHCenter); // ui->countdownLabel->setAlignment(Qt::AlignHCenter);
// ui->statusLabel->setAlignment(Qt::AlignRight); // ui->statusLabel->setAlignment(Qt::AlignRight);
m_curX = 0; m_curX = 0;
connect(&m_lableScrollTimer,SIGNAL(timeout()),this,SLOT(lableScrollDisplay())); connect(&m_lableScrollTimer,SIGNAL(timeout()),this,SLOT(lableScrollDisplay()));
@ -67,10 +69,10 @@ void MainWidget::updateUi()
m_curX = 0;//内容超出显示区域时,更新患者信息显示从头开始滚动 m_curX = 0;//内容超出显示区域时,更新患者信息显示从头开始滚动
//更新statusLabel //更新statusLabel
// ui->statusLabel->setText(QString("%1 | %2") // ui->statusLabel->setText(QString("%1 | %2")
// .arg(m_wsConnectedStatus == 0 ? "未连接" : "已连接") // .arg(m_wsConnectedStatus == 0 ? "未连接" : "已连接")
// .arg(m_patientEmergencyInfos.length()) // .arg(m_patientEmergencyInfos.length())
// ); // );
if(m_wsConnectedStatus){ if(m_wsConnectedStatus){
ui->LEDLabel->setStyleSheet("border-image: url(:/image/1LED_green.png);"); ui->LEDLabel->setStyleSheet("border-image: url(:/image/1LED_green.png);");
}else{ }else{
@ -98,7 +100,7 @@ void MainWidget::updateUi()
int hour,min,sec,nTotalSecs; int hour,min,sec,nTotalSecs;
nTotalSecs = pInfo->realCountDownInSeconds; nTotalSecs = pInfo->realCountDownInSeconds;
sec = nTotalSecs % 60; sec = nTotalSecs % 60;
// min = nTotalSecs / 60 % 60; // min = nTotalSecs / 60 % 60;
min = nTotalSecs / 60 ; //min显示大于60 min = nTotalSecs / 60 ; //min显示大于60
hour = nTotalSecs / 3600; hour = nTotalSecs / 3600;
QString str = QString("%1:%2").arg(min,2,10,QLatin1Char('0')).arg(sec,2,10,QLatin1Char('0')); QString str = QString("%1:%2").arg(min,2,10,QLatin1Char('0')).arg(sec,2,10,QLatin1Char('0'));
@ -110,7 +112,7 @@ void MainWidget::paintEvent(QPaintEvent *event)
//设置背景图片 //设置背景图片
QPainter p(this); QPainter p(this);
p.drawPixmap(0,0,this->width(),this->height(),QPixmap(":/image/black_bg.jpg")); p.drawPixmap(0,0,this->width(),this->height(),QPixmap(":/image/black_bg.jpg"));
// qDebug() << "MainWidget::paintEvent"; // qDebug() << "MainWidget::paintEvent";
//重新调整label字体大小 //重新调整label字体大小
//TODO //TODO
@ -121,7 +123,7 @@ void MainWidget::resizeEvent(QResizeEvent *event)
QWidget::resizeEvent(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->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->LEDLabel->setGeometry(this->width()-120,this->height()-30,20,30);
ui->statusLabel->setGeometry(this->width()-80,this->height()-30,20,30); ui->statusLabel->setGeometry(this->width()-80,this->height()-30,20,30);
@ -137,7 +139,7 @@ void MainWidget::lableScrollDisplay()
else{ else{
m_curX ++; m_curX ++;
ui->textLabel->setGeometry(20-m_curX,0,m_width,(this->height()-30)/2); ui->textLabel->setGeometry(20-m_curX,0,m_width,(this->height()-30)/2);
// qDebug()<<"move" <<m_curX; // qDebug()<<"move" <<m_curX;
} }
if(m_curX > (m_width - this->width())){ if(m_curX > (m_width - this->width())){
m_curX = 0; m_curX = 0;
@ -183,7 +185,7 @@ void MainWidget::onPatientMergencyStatusChanged(QString firstAidId,QString time,
void MainWidget::onKeyClicked() void MainWidget::onKeyClicked()
{ {
// emit onKeyStart(); emit complexOneKeyStart("142733198703123918","彭于晏","1","汉族");
qDebug() << "Key Clicked"; qDebug() << "Key Clicked";
} }
@ -212,3 +214,13 @@ void MainWidget::deletePatientFromList(QString firstAidId)
} }
} }
} }
void MainWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
if(event->button()==Qt::LeftButton){
//TODO
}
else if(event->button()==Qt::RightButton){
onKeyClicked();
}
}

4
mainwidget.h

@ -19,6 +19,7 @@ public:
~MainWidget(); ~MainWidget();
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
private: private:
Ui::MainWidget *ui; Ui::MainWidget *ui;
@ -45,6 +46,9 @@ public slots:
signals: signals:
void statusChanged(QString firstAidId,QString status); void statusChanged(QString firstAidId,QString status);
void complexOneKeyStart(QString idcard,QString name,QString sex,QString nation);
void sendCardInfo(QString idcard,QString name,QString sex,QString nation);
void oneKeyStart(QString idcard);
}; };
#endif // MAINWIDGET_H #endif // MAINWIDGET_H

9
resttest

@ -1,9 +0,0 @@
https://example.com/comments/1
POST https://example.com/comments HTTP/1.1
content-type: application/json
{
"name": "sample",
"time": "Wed, 21 Oct 2015 18:27:50 GMT"
}
Loading…
Cancel
Save