summaryrefslogtreecommitdiffstats
path: root/subsurface-mobile-helper.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-30 14:17:04 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-30 14:17:04 -0800
commit26fbcb0b742947eb351606e137cf9520b0912e2b (patch)
tree89e4980232c816e9a7409c360d272b84078fe0df /subsurface-mobile-helper.cpp
parent2311bc23787c12b5ce6abe0c995fc23f8d2ddce1 (diff)
downloadsubsurface-26fbcb0b742947eb351606e137cf9520b0912e2b.tar.gz
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: <bundle>/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 <dirk@hohndel.org>
Diffstat (limited to 'subsurface-mobile-helper.cpp')
-rw-r--r--subsurface-mobile-helper.cpp13
1 files changed, 13 insertions, 0 deletions
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<QMLManager>("org.subsurfacedivelog.mobile", 1, 0, "QMLManager");
qmlRegisterType<QMLProfile>("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 <bundle>/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);