Results 1 to 5 of 5

Thread: Sorting algorithm to sort data based on common keys

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2015
    Posts
    109
    Thanks
    20
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Sorting algorithm to sort data based on common keys

    Sorting means not to sort in ascending or descending order, I want all the data having the same key in one container.
    I found one solution for that, use QMultiHash or QMultiMap, here it can allow adding multiple data under the same key, so in that way, I can distinguish or sort data.

    But still, I'm looking for an option where I can have one key and data can be added under that key only, not the way QMultiHash work, as it stores key and data in a separate list even if keys are same.
    Last edited by npatil15; 20th June 2019 at 07:41.

  2. #2
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    512
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Sorting algorithm to sort data based on common keys

    Maybe a QMap < QString, QList < QJsonValue > >?

    Ginsengelf

  3. The following user says thank you to Ginsengelf for this useful post:

    npatil15 (20th June 2019)

  4. #3
    Join Date
    Jun 2015
    Posts
    109
    Thanks
    20
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Sorting algorithm to sort data based on common keys

    Thank you Ginsengelf, it works like a charm

Similar Threads

  1. How to sort images in Qt based on Time
    By iswaryasenthilkumar in forum Newbie
    Replies: 4
    Last Post: 11th February 2015, 11:10
  2. keys on keypad of ARM based iMX25(freescale) board is not responding.
    By sanjeet in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 29th August 2013, 13:34
  3. Help to set up sorting algorithm
    By Quasar in forum General Programming
    Replies: 2
    Last Post: 12th June 2012, 00:16
  4. File based merge sort
    By pixx in forum Newbie
    Replies: 4
    Last Post: 9th December 2010, 00:08
  5. Easy algorithm to encrypt / decrypt string data?
    By Mike in forum Qt Programming
    Replies: 7
    Last Post: 2nd March 2006, 06:42

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.