diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-11-30 14:17:04 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-11-30 14:17:04 -0800 |
commit | 26fbcb0b742947eb351606e137cf9520b0912e2b (patch) | |
tree | 89e4980232c816e9a7409c360d272b84078fe0df | |
parent | 2311bc23787c12b5ce6abe0c995fc23f8d2ddce1 (diff) | |
download | subsurface-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>
-rw-r--r-- | subsurface-mobile-helper.cpp | 13 |
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); |