Skip to content
Snippets Groups Projects

Service Object

Example of switching C++ object and QML dummy.

context-object

Make main.qml check if C++ serviceObject has been defined. If not, set it to DummyService {}.

context-object-file

Use separate main.qml or main-pure.qml for C++ or QML-only environment respectively. In main-pure.qml, instantiate DummyService {} in place of setContextProperties().

iniital-property (Qt 5.14+)

Set service property to DummyService {} by default. Override it by C++ setInitialProperties() call.

pseudo-initial-property

Initialize service property as DummyService {} first. Once QML loaded, overwrite it by C++ setProperty() call.