Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Please show me how to iterate QMap<QString ,QList<structure *>> obj in Qt ?
Forum Updated to NodeBB v4.3 + New Features

Please show me how to iterate QMap<QString ,QList<structure *>> obj in Qt ?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 648 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    avinash.r.p
    wrote on last edited by aha_1980
    #1

    Please show me how to iterate QMap<QString ,QList<structure *>> obj in Qt ?

    JonBJ Pl45m4P 2 Replies Last reply
    1
    • A avinash.r.p

      Please show me how to iterate QMap<QString ,QList<structure *>> obj in Qt ?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @avinash-r-p
      Not sure which you mean, but QMap can be iterated via https://doc.qt.io/qt-5/qmap-iterator.html, and QList 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...

      1 Reply Last reply
      5
      • A avinash.r.p

        Please show me how to iterate QMap<QString ,QList<structure *>> obj in Qt ?

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote on last edited by Pl45m4
        #3

        @avinash-r-p

        I guess you have problems iterating your combination of these containers?!
        If you know how to iterate through a QMap, 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 your obj.value with a complex datatype (your mapped QList of structure * structs instead of an int).
        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.


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        1 Reply Last reply
        4

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved