I am currently using properties, declared in the root qml file, and they work globally, because of dynamic scoping, but I am worrying that eventually they will pose too much lookup overhead, especially as the object tree grows deeper, which it eventually will.
There is also the possibility to use a context property object, however that increases verbosity, and also:
The disadvantage is that the v4 engine can not deal with dynamic objects, for example those exported from C++ via setContextProperty(). A binding containing such a dynamic object will be part of QV8Bindings.
From what I've read singletons should be even more efficient in terms of lookup performance, but they are even more verbose - requiring both import statements and accessing individual properties as singleton members rather than directly, and last but not least there is also the age old yet still unfixed QTBUG-34418 which is detrimental when using QML over network.
So what would be the most efficient way to implement a set of global properties in QML, considering the following criteria:
- lookup performance
- ease of use / low verbosity
- compatibility with
Settings
to make the value changes persist across application runs - must support value change notifications and automatic binding updates