You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unlike qmlscene, sailfish-qml does accept any command line arguments for appending to the QML import path. This basically prevents non-C++ QML programs from having QML only modules as they can't add their application qml folder to the QML import path.
Example:
Consider application "foo" that lives in /user/share/harbour-foo with qml files in /user/share/harbour-foo/qml, which has a QML-only module living in /user/share/harbour-foo/qml/Bar. Bar has a qmldir file and is a normal QML-only module.
With qmlscene it is possible to run the application like this:
The application can use this for of importing the Bar module:
import Bar 1.0
This has multiple advantages:
independent on the location of the file importing the module
supports module versioning
it is possible to switch between different API-compatible modules by manipulating the import path at startup (for example API compatible Platform-specific components)
looks nice and clean
However, sailfish-qml does not support appending to the import path,
so the application can only directly import modules from the current working directory:
import "Bar"
This has multiple disadvantages:
looks ugly
file location dependent (some files might have "../Bar", "../../Bar", etc.)
no support for versioning
no support for module switching without direct source file mangling
Background usecase:
The modRana navigation system uses the Universal Components set, that abstracts platform differences by providing a unified API but uses the native component set on each platform, resulting in a native looking but multi-platform application with a single UI source code.
To achieve this, the application manipulates the QML import path by adding path to the UC module for the given platform. All the UC modules are API compatible - on desktop the application will add path to the directory with the UC module using QtQucik Controls as backend, on Sailfish OS it will add path to the directory where the UC module that uses the Sailfish Silica backend is located.
Unfortunately this is not possible at the moment as sailfish-qml does not support appending to the QML import path, so modRana needs to do some pretty ugly & fragile source code mangling during packaging.
The text was updated successfully, but these errors were encountered:
Unlike qmlscene, sailfish-qml does accept any command line arguments for appending to the QML import path. This basically prevents non-C++ QML programs from having QML only modules as they can't add their application qml folder to the QML import path.
Example:
Consider application "foo" that lives in /user/share/harbour-foo with qml files in /user/share/harbour-foo/qml, which has a QML-only module living in /user/share/harbour-foo/qml/Bar. Bar has a qmldir file and is a normal QML-only module.
With qmlscene it is possible to run the application like this:
The application can use this for of importing the Bar module:
This has multiple advantages:
However, sailfish-qml does not support appending to the import path,
so the application can only directly import modules from the current working directory:
This has multiple disadvantages:
Background usecase:
The modRana navigation system uses the Universal Components set, that abstracts platform differences by providing a unified API but uses the native component set on each platform, resulting in a native looking but multi-platform application with a single UI source code.
To achieve this, the application manipulates the QML import path by adding path to the UC module for the given platform. All the UC modules are API compatible - on desktop the application will add path to the directory with the UC module using QtQucik Controls as backend, on Sailfish OS it will add path to the directory where the UC module that uses the Sailfish Silica backend is located.
Unfortunately this is not possible at the moment as sailfish-qml does not support appending to the QML import path, so modRana needs to do some pretty ugly & fragile source code mangling during packaging.
The text was updated successfully, but these errors were encountered: