修复Android和PC端适配问题

This commit is contained in:
2026-05-01 11:35:44 +08:00
parent 9de69ba60d
commit 0e7d5fab2b
4 changed files with 803 additions and 354 deletions
+12
View File
@@ -1,5 +1,7 @@
#include <QGuiApplication>
#include <QIcon>
#include <QLibraryInfo>
#include <QDir>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickStyle>
@@ -32,6 +34,16 @@ int main(int argc, char *argv[])
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"));