emsApplication/applications/EmsShower/main.cpp

55 lines
1.2 KiB
C++
Raw Normal View History

2025-03-04 14:22:27 +08:00
#ifdef _DEBUG
#include <vld.h>
#endif
2025-03-04 11:27:16 +08:00
#include "mainwindow.h"
2025-03-04 17:19:03 +08:00
#include "appinit.h"
2025-03-04 11:27:16 +08:00
#include <QApplication>
2025-03-04 17:19:03 +08:00
#include <QFile>
#include <QFont>
2025-03-04 11:27:16 +08:00
#include <QLocale>
#include <QTranslator>
2025-03-04 17:19:03 +08:00
#include <QStyleFactory>
2025-03-04 11:27:16 +08:00
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
2025-03-04 17:19:03 +08:00
//QApplication::setStyle(QStyleFactory::create("Fusion"));
//加载样式表
QFile file(":/css/index.css");
if (file.open(QFile::ReadOnly))
{
QString qss = QLatin1String(file.readAll());
qApp->setStyleSheet(qss);
file.close();
}
//全局字体
QFont font("Arial", 10);
a.setFont(font);
2025-03-04 11:27:16 +08:00
QTranslator translator;
const QStringList uiLanguages = QLocale::system().uiLanguages();
2025-03-04 14:22:27 +08:00
for (const QString &locale : uiLanguages)
{
2025-03-04 11:27:16 +08:00
const QString baseName = "EmsShower_" + QLocale(locale).name();
2025-03-04 14:22:27 +08:00
if (translator.load(":/i18n/" + baseName))
{
2025-03-04 11:27:16 +08:00
a.installTranslator(&translator);
break;
}
}
2025-03-04 17:19:03 +08:00
//屏幕拖动
AppInit::Instance()->start();
2025-03-04 11:27:16 +08:00
MainWindow w;
2025-03-04 17:19:03 +08:00
w.setStyleSheet("background-color: white;");
//w.setWindowFlags(Qt::FramelessWindowHint);
//w.setAttribute(Qt::WA_TranslucentBackground);
w.showMaximized();
//w.show();
2025-03-04 11:27:16 +08:00
return a.exec();
}