Is it safe if a qml singleton is depended on another qml singleton

170 views Asked by At

I have the following file structure:

\qml
  someQmlFile.qml
  someOtherQmlfilw.qml
  \Singletons
    firstSingleton.qml
    secondSingleton.qml

I need to access some of the properties in firstSingleton.qml within secondSingleton.qml. How is the order of singleton file creation defined? I tried looking into the docs, but I didn't find any specific information regarding this issue.

Edit 1: Some clarifications

firstSingleton.qml:

QtObject {
  readonly property int value: 5
}

secondSingleton.qml:

QtObject {
  readonly property int value: firstSingleton.value + 10
}

What happens if on startup sencondSingleton is created before firstSingleton? Should Qt handle this somehow in a clever way, or should I be able to somehow specify the order of creation of my singletons?

0

There are 0 answers