we have two parts to do this :
First one allowing your application to use shared folders
Steps:
- Go to bar-descriptor.xml in your project
- select Application
- check true in shared files
Second one is Get the correct path using C++ and send it to Qml in context property
This in your ApllicationUI.cpp C++ Code
// Build the path, add it as a context property, and expose
// it to QML
QString workingDir = QDir::currentPath();
QString path = "file://" + workingDir +"/shared/documents/model.xml";
QDeclarativePropertyMap* dirPaths = new QDeclarativePropertyMap;
dirPaths->insert("documents", QVariant(QString(path)));
qml->setContextProperty("dirPaths", dirPaths);
QML
dataModel: XmlDataModel {
source: dirPaths.documents
}