qt_demoe/ui/uidemo09/main.cpp

37 lines
979 B
C++
Raw Normal View History

2021-11-17 07:33:19 +00:00
#include "frmmain.h"
#include "appinit.h"
#include "quihelper.h"
int main(int argc, char *argv[])
{
//设置不应用操作系统设置比如字体
QApplication::setDesktopSettingsAware(false);
2022-01-13 03:27:55 +00:00
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
QApplication::setAttribute(Qt::AA_Use96Dpi);
#endif
2021-11-17 07:33:19 +00:00
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
2022-01-13 03:27:55 +00:00
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Floor);
2021-11-17 07:33:19 +00:00
#endif
QApplication a(argc, argv);
AppInit::Instance()->start();
QUIHelper::setFont();
QUIHelper::setCode();
//加载样式表
2021-12-15 05:21:29 +00:00
QFile file(":/qss/blacksoft.css");
2021-11-17 07:33:19 +00:00
if (file.open(QFile::ReadOnly)) {
QString qss = QLatin1String(file.readAll());
QString paletteColor = qss.mid(20, 7);
qApp->setPalette(QPalette(paletteColor));
qApp->setStyleSheet(qss);
file.close();
}
frmMain w;
QUIHelper::setFormInCenter(&w);
w.show();
return a.exec();
}