Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] Define states into separate QML file



  • Dear all,

    is there any way how to achieve this. I would like to have a separate QML component consisting only of a list of states, so that I can write something like this:

    Item {
      states: States{}
    }
    

    Thanks and best regards,
    Markus



  • Meanwhile I found a solution by myself as follows:

    main.qml

    States { id: states }
    states: states.myStates
    

    States.qml

    Item {
        property list<State> myStates: [
            State {},
            State {},
            State {}
        }
    }
    

    Is this already the best way to achieve what I want or are there any better solutions?

    Thanks and best regards,
    Markus


Log in to reply