Results 1 to 2 of 2

Thread: Can I use something like QMap<int, QString> buwith repeated keys?

  1. #1
    Join Date
    Apr 2009
    Posts
    132
    Thanks
    67
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Can I use something like QMap<int, QString> buwith repeated keys?

    Hi friends?

    I have several strings and each one have a integer value property (same times 2 differnte strings have the same integer value )

    I read this on http://doc.trolltech.com/4.5/qmap.html
    "If you want to sort your strings in an arbitrary order, consider using the QMap class. For example, you could use a QMap<QString, QString> to create a case-insensitive ordering (e.g. with the keys being lower-case versions of the strings, and the values being the strings), or a QMap<int, QString> to sort the strings by some integer index."

    I'd like to order them using this value, the problem is that I can't use a map because key must be unique.

    Do you have any other suggestion?

    Thanks in advance.

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Can I use something like QMap<int, QString> buwith repeated keys?

    take a look at QMultiMap.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.