实现启动splash画面,实现天历史数据的处理和数据库存贮

This commit is contained in:
lixiaoyuan
2025-09-09 19:26:05 +08:00
parent 5c94e2098a
commit b2338f21b0
29 changed files with 426 additions and 71 deletions

57
src/qt/MainWeb.cpp Normal file
View File

@@ -0,0 +1,57 @@
#include "MainWeb.h"
#include "app/Config.h"
#include <QCoreApplication>
#include <QLabel>
#include <QThread>
void MySplash(MainWeb* mainWin)
{
//===动态程序启动画面===
QPixmap pixmap("./assets/ui/splash.png");
QSplashScreen splash(pixmap);
splash.show();
QCoreApplication::processEvents();
QLabel label(&splash);
label.setStyleSheet("background-color: gray");
label.setGeometry(100, 480, 800, 20);
label.show();
QLabel labelProgress(&splash);
labelProgress.setStyleSheet("background-color: rgb(29, 54, 102)");
labelProgress.setGeometry(10, 10, 0, 20);
labelProgress.show();
int i = 0;
while ((++i)<500)
{
splash.showMessage(QString("Loading... %1 ms").arg(i), Qt::AlignBottom | Qt::AlignRight, Qt::black);
labelProgress.setGeometry(100, 480, i*2*0.8, 20);
QThread::msleep(10);
}
splash.finish(mainWin);//程序启动画面结束
}
MainWeb::MainWeb()
{
this->setWindowTitle("光储充站监控与运营管理平台");
this->setGeometry(0, 0, 1920, 1080);
webView.setGeometry(0, 0, 1920, 1080);
// 默认设置透明, 解决加载时的白屏闪烁
webView.page()->setBackgroundColor(Qt::transparent);
webView.setContextMenuPolicy(Qt::NoContextMenu);
webView.load(QUrl(Config::option.webSrvUrl.c_str()));
//webView.load(QUrl("file:///assets/html/main.html"));
//connect(wWebView.get(), &QWebEngineView::loadFinished, this, &MyWidget::slotLoadFinished);
//std::string htmlContent = "HelloWorld";
//webView->setHtml(htmlContent.c_str(), QUrl("file:///assets/html/"));
webView.show();
this->setCentralWidget(&webView);
MySplash(this);
this->show();
}

14
src/qt/MainWeb.h Normal file
View File

@@ -0,0 +1,14 @@
#include <QMainWindow>
#include <QtWebEngineWidgets/QWebEngineView>
#include <QSplashScreen>
class MainWeb : public QMainWindow
{
public:
MainWeb();
QWebEngineView webView;
};