2023-02-24 18:44:29 +08:00
|
|
|
|
#include <QGuiApplication>
|
|
|
|
|
#include <QQmlApplicationEngine>
|
2023-03-02 18:21:43 +08:00
|
|
|
|
#include "InstallHelper.h"
|
2023-02-26 23:47:07 +08:00
|
|
|
|
|
|
|
|
|
#if defined(STATICLIB)
|
|
|
|
|
#include <FluentUI.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-02-24 18:44:29 +08:00
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
2023-03-02 18:21:43 +08:00
|
|
|
|
QCoreApplication::setOrganizationName("ZhuZiChu");
|
|
|
|
|
QCoreApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
|
|
|
|
QCoreApplication::setApplicationName("FluentUI");
|
|
|
|
|
|
2023-02-27 23:04:52 +08:00
|
|
|
|
qputenv("QSG_RENDER_LOOP","basic");
|
2023-03-02 00:35:58 +08:00
|
|
|
|
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
|
|
|
|
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
|
|
|
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
|
|
|
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
|
|
|
|
#endif
|
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
|
|
|
|
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Round);
|
|
|
|
|
#endif
|
2023-03-02 18:21:43 +08:00
|
|
|
|
// QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
2023-02-24 18:44:29 +08:00
|
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
|
QQmlApplicationEngine engine;
|
2023-03-02 18:21:43 +08:00
|
|
|
|
|
|
|
|
|
qmlRegisterType<InstallHelper>("UI",1,0,"InstallHelper");
|
|
|
|
|
|
|
|
|
|
#if defined(STATICLIB)
|
|
|
|
|
FluentUI::create(&engine);
|
|
|
|
|
#endif
|
2023-02-26 23:47:07 +08:00
|
|
|
|
const QUrl url(QStringLiteral("qrc:/App.qml"));
|
|
|
|
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
|
|
|
|
&app, [url](QObject *obj, const QUrl &objUrl) {
|
|
|
|
|
if (!obj && url == objUrl)
|
|
|
|
|
QCoreApplication::exit(-1);
|
|
|
|
|
}, Qt::QueuedConnection);
|
|
|
|
|
engine.load(url);
|
2023-02-24 18:44:29 +08:00
|
|
|
|
return app.exec();
|
|
|
|
|
}
|