初始化毕业设计项目
This commit is contained in:
+63
@@ -0,0 +1,63 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QIcon>
|
||||
#include <QLibraryInfo>
|
||||
#include <QDir>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QQuickStyle>
|
||||
#include <QQuickWindow>
|
||||
|
||||
#include "src/AppController.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QGuiApplication app(argc, argv);
|
||||
QIcon appIcon(QStringLiteral(":/assets/favicon.ico"));
|
||||
appIcon.addFile(QStringLiteral(":/assets/favicon-256x256.png"));
|
||||
appIcon.addFile(QStringLiteral(":/assets/favicon-192x192.png"));
|
||||
appIcon.addFile(QStringLiteral(":/assets/favicon-128x128.png"));
|
||||
appIcon.addFile(QStringLiteral(":/assets/favicon-64x64.png"));
|
||||
appIcon.addFile(QStringLiteral(":/assets/favicon-48x48.png"));
|
||||
appIcon.addFile(QStringLiteral(":/assets/favicon-32x32.png"));
|
||||
appIcon.addFile(QStringLiteral(":/assets/favicon-16x16.png"));
|
||||
app.setWindowIcon(appIcon);
|
||||
|
||||
QCoreApplication::setApplicationName("人脸识别考勤系统");
|
||||
QCoreApplication::setApplicationVersion("3.0.0");
|
||||
QCoreApplication::setOrganizationName("STM32 Face Recognition");
|
||||
QQuickStyle::setStyle("Basic");
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
QQuickWindow::setTextRenderType(QQuickWindow::NativeTextRendering);
|
||||
#endif
|
||||
|
||||
AppController controller;
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
const QString qmlImportPath = QLibraryInfo::path(QLibraryInfo::QmlImportsPath);
|
||||
if (!qmlImportPath.isEmpty()) {
|
||||
engine.addImportPath(qmlImportPath);
|
||||
}
|
||||
#if defined(REWRITE_QT_INSTALL_QML)
|
||||
const QString qtInstallQmlPath = QStringLiteral(REWRITE_QT_INSTALL_QML);
|
||||
if (QDir(qtInstallQmlPath).exists()) {
|
||||
engine.addImportPath(qtInstallQmlPath);
|
||||
}
|
||||
#endif
|
||||
engine.rootContext()->setContextProperty("appController", &controller);
|
||||
|
||||
const QUrl url(QStringLiteral("qrc:/qml/Main.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);
|
||||
return app.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user