From a41da91fc6f2c4438c2ec80f7a2cf2c7a2694646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20L=C3=B3pez-Cabanillas?= Date: Sun, 6 Nov 2022 19:33:51 +0100 Subject: [PATCH] fixed splash --- playermain.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/playermain.cpp b/playermain.cpp index 66400b4..9f2ab0a 100644 --- a/playermain.cpp +++ b/playermain.cpp @@ -77,21 +77,20 @@ int main(int argc, char *argv[]) parser.addPositionalArgument("file", QCoreApplication::tr("Input SMF/KAR/WRK file name."), "[file]"); parser.process(app); - QSplashScreen *pSplash = nullptr; + QScopedPointer pSplash; if (app.platformName() != "wayland") { QPixmap px(":/splash.png"); qreal scale = app.primaryScreen()->logicalDotsPerInch() / app.primaryScreen()->physicalDotsPerInch(); QSize newsize = px.size() * scale; px = px.scaled(newsize, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); - QSplashScreen splash(px); - pSplash = &splash; + pSplash.reset(new QSplashScreen(px)); QFont sf = QApplication::font(); sf.setPointSize(20); - splash.setFont(sf); - splash.show(); + pSplash->setFont(sf); + pSplash->show(); app.processEvents(); - splash.showMessage(QSTR_APPNAME + " v" + strVersion, - Qt::AlignBottom | Qt::AlignHCenter, Qt::white); + pSplash->showMessage(QSTR_APPNAME + " v" + strVersion, + Qt::AlignBottom | Qt::AlignHCenter, Qt::white); app.processEvents(); } if (parser.isSet(portableOption) || parser.isSet(portableFileName)) { @@ -115,7 +114,7 @@ int main(int argc, char *argv[]) try { GUIPlayer w; - if (pSplash != nullptr) { + if (!pSplash.isNull()) { pSplash->finish(&w); } w.setAttribute(Qt::WA_QuitOnClose);