Please show me how to iterate QMap<QString ,QList<structure *>> obj in Qt ?
-
Please show me how to iterate QMap<QString ,QList<structure *>> obj in Qt ?
-
Please show me how to iterate QMap<QString ,QList<structure *>> obj in Qt ?
@avinash-r-p
Not sure which you mean, butQMap
can be iterated via https://doc.qt.io/qt-5/qmap-iterator.html, andQList
via https://doc.qt.io/qt-5/qlist-iterator.html. You access a map item's value via https://doc.qt.io/qt-5/qmap-iterator.html#value. See also https://stackoverflow.com/questions/8517853/iterating-over-a-qmap-with-for for an example. Not sure what else there is to say... -
Please show me how to iterate QMap<QString ,QList<structure *>> obj in Qt ?
@avinash-r-p
I guess you have problems iterating your combination of these containers?!
If you know how to iterate through aQMap
, replace (in your head)QList<struct *>
with a primitive data type (like an integer). Then think about it, how it would look like and what you need to change, if you replace yourobj.value
with a complex datatype (your mappedQList
ofstructure *
structs instead of anint
).
It's not that hard :-) @JonB already provided useful links which will show you how to iterate through every of your mentioned containers. You just need to combine them.