From 26fbcb0b742947eb351606e137cf9520b0912e2b Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 30 Nov 2015 14:17:04 -0800 Subject: Fix QML component import path when running Mac bundle of Subsurface-mobile When running the QML UI on a Mac the deployment of the QML Components seems to fail and the search path for the components is rather odd - simply the same directory the executable was started from: /Contents/MacOS/ To work around this we need to manually copy the components at install time to Contents/Frameworks/qml (not covered in this commit) and make sure that we add the correct import path. Signed-off-by: Dirk Hohndel --- subsurface-mobile-helper.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'subsurface-mobile-helper.cpp') diff --git a/subsurface-mobile-helper.cpp b/subsurface-mobile-helper.cpp index e2b32d3b2..8dd28f60d 100644 --- a/subsurface-mobile-helper.cpp +++ b/subsurface-mobile-helper.cpp @@ -31,6 +31,19 @@ void run_ui() qmlRegisterType("org.subsurfacedivelog.mobile", 1, 0, "QMLManager"); qmlRegisterType("org.subsurfacedivelog.mobile", 1, 0, "QMLProfile"); QQmlApplicationEngine engine; +#if __APPLE__ + // when running the QML UI on a Mac the deployment of the QML Components seems + // to fail and the search path for the components is rather odd - simply the + // same directory the executable was started from /Contents/MacOS/ + // To work around this we need to manually copy the components at install time + // to Contents/Frameworks/qml and make sure that we add the correct import path + QStringList importPathList = engine.importPathList(); + Q_FOREACH(QString importPath, importPathList) { + if (importPath.contains("MacOS")) + engine.addImportPath(importPath.replace("MacOS", "Frameworks")); + } + qDebug() << "QML import path" << engine.importPathList(); +#endif engine.addImportPath("qrc://imports"); DiveListModel diveListModel; QSortFilterProxyModel *sortModel = new QSortFilterProxyModel(0); -- cgit v1.2.3-70-g09d2