mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
实现QT6启动器,QT版本有qt5升级到qt6
This commit is contained in:
86
src/main.cpp
86
src/main.cpp
@@ -15,10 +15,7 @@
|
||||
|
||||
#include "widgets/MainWindow.h"
|
||||
|
||||
#include "pv/PvApp.h"
|
||||
#include "pv/PvUser.h"
|
||||
|
||||
#include "rlsocket.h"
|
||||
#include "common/Spdlogger.h"
|
||||
#include "database/DaoEntity.h"
|
||||
|
||||
@@ -32,25 +29,25 @@
|
||||
|
||||
#include "qt/MainWeb.h"
|
||||
|
||||
#define wsa rlwsa
|
||||
void rlSocketTest()
|
||||
{
|
||||
rlwsa();
|
||||
rlSocket socket("127.0.0.1", 19801, 1);
|
||||
int ret = socket.connect();
|
||||
std::string s1 = "helloworld";
|
||||
socket.write(s1.c_str(), s1.size());
|
||||
|
||||
std::vector<char> buf(1024, 0);
|
||||
while (true)
|
||||
{
|
||||
int len = socket.read(&buf[0], 1, 0);
|
||||
if (len > 0)
|
||||
{
|
||||
std::cout << "===>>> " << std::string(buf.begin(), buf.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
//#define wsa rlwsa
|
||||
//void rlSocketTest()
|
||||
//{
|
||||
// rlwsa();
|
||||
// rlSocket socket("127.0.0.1", 19801, 1);
|
||||
// int ret = socket.connect();
|
||||
// std::string s1 = "helloworld";
|
||||
// socket.write(s1.c_str(), s1.size());
|
||||
//
|
||||
// std::vector<char> buf(1024, 0);
|
||||
// while (true)
|
||||
// {
|
||||
// int len = socket.read(&buf[0], 1, 0);
|
||||
// if (len > 0)
|
||||
// {
|
||||
// std::cout << "===>>> " << std::string(buf.begin(), buf.end());
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
void memberJsonTest()
|
||||
{
|
||||
@@ -142,27 +139,42 @@ int main(int argc, char** argv)
|
||||
Application::instance().init();
|
||||
|
||||
// 启动 PV 服务主线程
|
||||
std::thread([=]()
|
||||
{
|
||||
// 运行pv主流程
|
||||
PARAM p;
|
||||
int s;
|
||||
pvInit(argc, argv, &p);
|
||||
/* here you may interpret ac,av and set p->user to your data */
|
||||
while (1)
|
||||
{
|
||||
s = pvAccept(&p);
|
||||
if (s != -1) pvCreateThread(&p, s);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
}).detach();
|
||||
//std::thread([=]()
|
||||
// {
|
||||
// // 运行pv主流程
|
||||
// PARAM p;
|
||||
// int s;
|
||||
// pvInit(argc, argv, &p);
|
||||
// /* here you may interpret ac,av and set p->user to your data */
|
||||
// while (1)
|
||||
// {
|
||||
// s = pvAccept(&p);
|
||||
// if (s != -1) pvCreateThread(&p, s);
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
// }
|
||||
// }).detach();
|
||||
|
||||
QApplication qapp(argc, argv);
|
||||
qapp.setWindowIcon(QIcon("./yhicon.ico"));
|
||||
MainWeb mainWin;
|
||||
mainWin.show();
|
||||
qapp.exec();
|
||||
|
||||
|
||||
//QApplication a(argc, argv);
|
||||
//QMainWindow w;
|
||||
|
||||
//QWebEngineView webView(&w);
|
||||
//webView.load(QUrl("http://127.0.0.1:19600/"));
|
||||
|
||||
//w.setCentralWidget(&webView);
|
||||
//w.setWindowTitle("Qt 6.7 WebEngine Demo");
|
||||
//w.resize(1280, 720);
|
||||
//w.show();
|
||||
//webView.show();
|
||||
//a.exec();
|
||||
|
||||
|
||||
|
||||
// 运行QT主窗口
|
||||
//QApplication qapp(argc, argv);
|
||||
//MainWindow mainWin;
|
||||
|
||||
Reference in New Issue
Block a user