View Single Post
Posts: 1,548 | Thanked: 7,510 times | Joined on Apr 2010 @ Czech Republic
#89
Originally Posted by taixzo View Post
Still a relative QML newbie here - is it possible to have an optional dependency on a QML plugin, such that an app could import it and draw maps if the user has it installed but work fine (without that UI component) otherwise?
Yeah, that's possible at the cost of some additional code complexity:

https://github.com/M4rtinK/modrana/b...Screen.qml#L32

Basically just try to load the element dynamically and handle the failure gracefully. Alternatively you can have a fake element that does nothing that you will load instead of the one that failed to load:

https://github.com/M4rtinK/modrana/b...ation.qml#L108

Of course everything would be much simpler if QML supported conditional imports like Python does.
__________________
modRana: a flexible GPS navigation system
Mieru: a flexible manga and comic book reader
Universal Components - a solution for native looking yet component set independent QML appliactions (QtQuick Controls 2 & Silica supported as backends)
 

The Following 4 Users Say Thank You to MartinK For This Useful Post: