Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Common/LtsWidgets/lts_splash.cpp
T
torstenandCopilot d6b6ffce7c Apply clang-format to Lts/Common and DTC/enum headers
- Formatted all CodeGen module files (9 files)
- Formatted LtsAppDescriptor module files
- Formatted LtsAppManager/AppChooser files
- Applied clang-format to all DTC and enum headers across modules
- Removed coordTransTests from CommonUnitTestsPlaceholder (moved to tests/)

Cosmetic changes only, no functional modifications.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-19 14:46:29 +02:00

72 lines
1.4 KiB
C++

#include "lts_splash.h"
#include <LtsWidgets/lts_global_wait_dialog.h>
#include <QCoreApplication>
#include <QEvent>
#include <QFile>
namespace LtsWidgets
{
Splash::Splash() : QSplashScreen(), m_done(false)
{
static const auto splashFiles = {
QStringLiteral(":/project/splash.png"),
QStringLiteral(":/project/splash.jpg"),
};
for (const QString& f : splashFiles)
{
if (!QFile::exists(f))
continue;
setPixmap(QPixmap(f));
break;
}
}
bool Splash::event(QEvent* e)
{
if (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonRelease ||
e->type() == QEvent::MouseButtonDblClick)
{
e->ignore();
return false;
}
return QSplashScreen::event(e);
}
void Splash::setMessage(const QString& message)
{
showMessage(message, Qt::AlignRight | Qt::AlignBottom);
}
void Splash::done()
{
if (m_done)
return;
m_done = true;
hide();
LtsWidgets::LtsGlobalWaitDialog::getInstance()->setVisible(true);
}
static Splash* s_splashInstance = nullptr;
void Splash::cleanupSplashInstance()
{
delete s_splashInstance;
s_splashInstance = nullptr;
}
Splash* Splash::getInstance()
{
if (!s_splashInstance)
{
s_splashInstance = new Splash;
qAddPostRoutine(&Splash::cleanupSplashInstance);
}
return s_splashInstance;
}
} // namespace LtsWidgets