Important: Please read the Qt Code of Conduct -

Handling complicated data model vector of vectors.

  • Hi!

    I was looking for answers in the web but nothing found. I'm writing IoT app that stores information from many sensors connected by some interface (it's not important write now). And i;m looking for way that i could pass data from this sensors to QML.

    The complication is that base class for data is "node" class that holds all properties needed for identification device like uuid, name and some serialization interface. And in "node" class there is another data structure witch is vector of different sensors. All sensors are derived from base class and have property (enum) that holds their type like: humidity, temperature, pressure etc. and of cors data.

    So summarizing i have vector of nodes, where individual nodes could store another vector of sensors connected to this nodes.
    And now how to pass this data to QML? I'm familiar with Qt model/view concept, but in situation i have in model vector of vectors and need to filter data from second vector to show for example temperature readings of current node.

    hope that I have presented the problem clearly and there is some solution.

    Best Regards!

  • Lifetime Qt Champion


    Wouldn't it be more practical to store these information in a database and then use the model view architecture to load what you want ?

  • Hmm.... it sounds good - sometimes is nice to have some outside view. Witch database do you recommend to work with that cain of data? Normal SQL with "node" object and relations to sensor readings? It will not be to slow?

  • Lifetime Qt Champion

    It will depend on the volume of data you are expecting to get and store.

    But that's a good starting point.

Log in to reply