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. Store three values in a container

Store three values in a container

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.1k Views 2 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.
  • D Offline
    D Offline
    Defohin
    wrote on last edited by Defohin
    #1

    Hi guys, I wondering what is the option for that case: I want to save like this: "name" => [ QIcon, MyClass * ], how can I reproduce that in Qt?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      Many ways to do so. :)

      struct MyItem{
      QIcon ico;
      MyClass *Class;
      };

      http://doc.qt.io/qt-5/qmap.html
      QMap<QString, MyItem > MyLookupList;

      Each string, will then give u struct ( with the 2 data in)

      1 Reply Last reply
      2
      • D Offline
        D Offline
        Defohin
        wrote on last edited by
        #3

        I juts got myself thinking: How could I forget about struct? haha.

        1 Reply Last reply
        1
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Well that happens :)

          1 Reply Last reply
          0
          • D Offline
            D Offline
            Defohin
            wrote on last edited by
            #5

            Thank you, you are awesome

            1 Reply Last reply
            1

            • Login

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