From bb9cfa48fb296910c2b88bd45413cad63715c1da Mon Sep 17 00:00:00 2001 From: Gouzuang <87839812+Gouzuang@users.noreply.github.com> Date: Sun, 13 Jul 2025 19:55:11 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=98=E5=8C=96]=20=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=EF=BC=9A=E9=87=8D=E6=9E=84=20nativeSplash=20?= =?UTF-8?q?=E7=B1=BB=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=B8=90=E5=8F=98=E5=8A=A8?= =?UTF-8?q?=E7=94=BB=E4=B8=8E=E8=BF=9B=E5=BA=A6=E6=9D=A1=EF=BC=8C=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E5=B8=83=E5=B1=80=E4=B8=8E=E6=A0=B7=E5=BC=8F=E6=8F=90?= =?UTF-8?q?=E5=8D=87=E8=A7=86=E8=A7=89=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 7 +- view/SplashScreen/nativesplash.cpp | 54 ++++++++-- view/SplashScreen/nativesplash.h | 2 + view/SplashScreen/nativesplash.ui | 158 +++++++++++++++-------------- 4 files changed, 132 insertions(+), 89 deletions(-) diff --git a/main.cpp b/main.cpp index 3eb2336..ec7e6d2 100644 --- a/main.cpp +++ b/main.cpp @@ -38,8 +38,8 @@ int main(int argc, char *argv[]) { qInstallMessageHandler(service::customMessageHandler); //拦截部分错误,真的修不好了喵眼不见心不烦 - //view::SplashScreen::SplashScreen splash; - //splash.show(); + view::SplashScreen::nativeSplash splash; + splash.show(); service::logger::instance().setLogFile( @@ -64,10 +64,11 @@ int main(int argc, char *argv[]) { view::login::loginPage b; b.show(); - //splash.close(); setup_tasks(); service::taskManager::getTimer().startAll(); + splash.closeSplash(); + return QApplication::exec(); } diff --git a/view/SplashScreen/nativesplash.cpp b/view/SplashScreen/nativesplash.cpp index 4bbd9da..90804e0 100644 --- a/view/SplashScreen/nativesplash.cpp +++ b/view/SplashScreen/nativesplash.cpp @@ -5,16 +5,52 @@ // You may need to build the project (run Qt uic code generator) to get "ui_nativeSplash.h" resolved #include "nativesplash.h" +#include +#include + #include "ui_nativeSplash.h" namespace view::SplashScreen { -nativeSplash::nativeSplash(QWidget *parent) : - QWidget(parent), ui(new Ui::nativeSplash) { - ui->setupUi(this); - service::style::setMica(this); -} - -nativeSplash::~nativeSplash() { - delete ui; -} + nativeSplash::nativeSplash(QWidget *parent) : QWidget(parent), ui(new Ui::nativeSplash) { + ui->setupUi(this); + service::style::setMica(this); + setWindowFlags(Qt::FramelessWindowHint | Qt::Tool | Qt::WindowStaysOnTopHint); + + QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this); + this->setGraphicsEffect(effect); + + QPropertyAnimation *anim = new QPropertyAnimation(effect, "opacity"); + anim->setDuration(800); + anim->setStartValue(0); + anim->setEndValue(1); + anim->setEasingCurve(QEasingCurve::OutQuad); + anim->start(QPropertyAnimation::DeleteWhenStopped); + + ui->progressBar->setMaximum(0); + ui->progressBar->setMinimum(0); + + play_animation(); + } + + nativeSplash::~nativeSplash() { + delete ui; + } + + void nativeSplash::closeSplash() { + QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this); + this->setGraphicsEffect(effect); + + + QPropertyAnimation *anim = new QPropertyAnimation(effect, "opacity"); + anim->setDuration(400); + anim->setStartValue(1); + anim->setEndValue(0); + anim->setEasingCurve(QEasingCurve::InQuad); + anim->start(QPropertyAnimation::DeleteWhenStopped); + connect(anim, &QPropertyAnimation::finished, this, &nativeSplash::close); + } + + void nativeSplash::play_animation() { + + } } // view::SplashScreen diff --git a/view/SplashScreen/nativesplash.h b/view/SplashScreen/nativesplash.h index 37e98eb..e99aa79 100644 --- a/view/SplashScreen/nativesplash.h +++ b/view/SplashScreen/nativesplash.h @@ -18,9 +18,11 @@ Q_OBJECT public: explicit nativeSplash(QWidget *parent = nullptr); ~nativeSplash() override; + void closeSplash(); private: Ui::nativeSplash *ui; + void play_animation(); }; } // view::SplashScreen diff --git a/view/SplashScreen/nativesplash.ui b/view/SplashScreen/nativesplash.ui index ca5bd81..b531c10 100644 --- a/view/SplashScreen/nativesplash.ui +++ b/view/SplashScreen/nativesplash.ui @@ -6,92 +6,96 @@ 0 0 - 662 - 449 + 611 + 419 nativeSplash - - - - - - 600 - 400 - - - - - 600 - 400 - - - - QFrame { - background-color: transparent; - border: none; - } - - - - QFrame::Shape::StyledPanel - - - QFrame::Shadow::Raised - - - - - 10 - -50 - 221 - 221 - - - - - 1 - 1 - - - - - - - :/Logo1.png - - - true - - - - - - 230 - 0 - 501 - 401 - - - - QLabel { + + + + + + + 0 + -60 + 221 + 221 + + + + + 1 + 1 + + + + + + + :/Logo1.png + + + true + + + + + + 200 + 0 + 551 + 431 + + + + QLabel { border-radius: 20px; background-clip: content-box; } - - - - - - :/landscape/BB1msMpB.jpg - - - - - + + + + + + :/landscape/BB1msMpB.jpg + + + + + + 10 + 370 + 171 + 41 + + + + + + + 24 + + + false + + + + + + 10 + 360 + 151 + 21 + + + + Loading resources... + +