#include #include #include #include #include #include #include #include #include "MessageHandle.h" // #include "PathUtil.h" #include "Application.h" #include "MainWindow.h" #include // #include #include #include #include #include #include "spdlog/spdlog.h" #include "spdlog/sinks/basic_file_sink.h" #include "Logger.h" int main(int argc, char *argv[]) { // 初始化日志 auto my_logger = get_shared_logger(); spdlog::set_default_logger(my_logger); LOG_INFO("Application start..."); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_UseOpenGLES); QApplication app(argc, argv); QWebEngineView *view = new QWebEngineView(); // ccsMainWindow *mainWindow = ccsMainWindow::instance(); ccsMainWindow mainWindow; QVBoxLayout *layout = new QVBoxLayout; // ccsElectricSubUIFunction::elementTree2Json(); layout->addWidget(view); mainWindow.setLayout(layout); QWebEngineSettings *settings = QWebEngineSettings::globalSettings(); // 设置中文字体 settings->setFontFamily(QWebEngineSettings::StandardFont, "SimHei"); // 设置标准字体(一般用于正文) ccsMessageHandle *msgHandler = ccsMessageHandle::instance(); ccsApplication *application = ccsApplication::instance(); QWebChannel *channel = new QWebChannel(msgHandler); channel->registerObject(QStringLiteral("ccsMessageHandle"), msgHandler); application->setMainWindow(&mainWindow); view->page()->setWebChannel(channel); mainWindow.setWindowTitle("COMPASS-I&F"); //qDebug() << PathUtil::bin_dir() + "web/index.html"; view->load(QUrl::fromLocalFile(PathUtil::bin_dir() + "web/index.html")); // 加载你的HTML资源文件 // view->setUrl(QUrl("http://192.168.2.120:4173/")); // view->setUrl(QUrl("http://192.168.2.132:4173/")); // view->setUrl(QUrl("http:localhost:4173/")); mainWindow.setCentralWidget(view); mainWindow.showMaximized(); return app.exec(); }