修复Android和PC端适配问题
This commit is contained in:
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user