mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 21:33:24 +00:00
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>
This commit is contained in:
parent
2311bc2378
commit
26fbcb0b74
1 changed files with 13 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue