Yeah, but my beef with it is that I must derive from QObject for that, don't I? I can live with not having notifications for the fields, is what I mean.

font is explicitly _not_ derived from QObject. That's the whole point of value types. Value types, however, cannot exist as root objects. They need to be a property of something.

I just have a stupid struct with 2-3 fields, that I'd love to initialize within the document tree. I did some hacking around and did provide this out of the parser (just ignoring the warning about registering value types with capital letter), but I was wondering if I missed some subtle problem. The whole idea of just having the god factory I find distastefulness and somewhat harder to read/reason about. Currently this is what it looks like for me:

property var person: Character {
    name: qsTr("Personname")
    age: Age {
        years: 1
        months: 0
    }

    Simulation.onAdvanced:{
        age.months++
    }
}

Well, yes, you need to declare the "person" property in C++ for now because you cannot have named value types. Once we get named value types (and some grammar fixes) you can do the following:

property person person {
    age {
        years: 1
        months: 0
    }
}

Simulation.onAdvanced: person.age.months++.
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to