Browse Source

程序启动切换到可执行文件所在目录

pull/4/head
zhangsan 4 years ago
parent
commit
a6a4b26e26
  1. 13
      main.cpp

13
main.cpp

@ -10,6 +10,9 @@ int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
//切换当前工作目录
QDir::setCurrent(QCoreApplication::applicationDirPath());
//初始化配置文件 //初始化配置文件
MainConfig::initConfig(); MainConfig::initConfig();
@ -29,19 +32,19 @@ int main(int argc, char *argv[])
//绑定信号与槽 //绑定信号与槽
QObject::connect(&websocketService,&WebsocketService::wsConnectedStatusChanged, QObject::connect(&websocketService,&WebsocketService::wsConnectedStatusChanged,
&w,&MainWidget::onWsConnectedStatusChanged); &w,&MainWidget::onWsConnectedStatusChanged);
QObject::connect(&websocketService,&WebsocketService::newPatientMergencyInfo, QObject::connect(&websocketService,&WebsocketService::newPatientMergencyInfo,
&w,&MainWidget::onNewPatientMergencyInfo); &w,&MainWidget::onNewPatientMergencyInfo);
QObject::connect(&websocketService,&WebsocketService::patientMergencyStatusChanged, QObject::connect(&websocketService,&WebsocketService::patientMergencyStatusChanged,
&w,&MainWidget::onPatientMergencyStatusChanged); &w,&MainWidget::onPatientMergencyStatusChanged);
QObject::connect(&deviceService,&DeviceService::keyClicked, QObject::connect(&deviceService,&DeviceService::keyClicked,
&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); QObject::connect(&w,&MainWidget::complexOneKeyStart,&httpService,&HttpService::onComplexOneKeyStart);
w.show(); w.show();
// w.showFullScreen(); // w.showFullScreen();
return a.exec(); return a.exec();
} }

Loading…
Cancel
Save