Results 1 to 12 of 12

Thread: Populating a combobox with a record obtained from a database

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2010
    Posts
    54
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Sorting a models records using quicksort

    Hmmm that seems pretty complex... are there any other ways? perhaps a work around which doesn't involve a model? I'm sure i'll think of a hacky way to do it eventually... i normally do, but it makes my code look rather messy

    Thanks and I'll keep you updated on what I do.

  2. #2
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Sorting a models records using quicksort

    perhaps a work around which doesn't involve a model?
    Then dont use model, use your own logic to populate the qcombobox.

    steps:
    1)use QSqlQuery to select the records from db.
    2)apply your QuickSort Alg
    3)populate your combobox based on QuickSort logic

    if you simply want to sort
    Qt Code:
    1. myCombo->model()->sort(0,Qt::DescendingOrder);
    To copy to clipboard, switch view to plain text mode 
    Note:
    you can also refer qSort(for containers)
    Bala

Similar Threads

  1. Querying a database and populating a combobox
    By Splatify in forum Newbie
    Replies: 7
    Last Post: 21st February 2011, 11:28
  2. Database combobox search
    By poporacer in forum Newbie
    Replies: 10
    Last Post: 24th October 2010, 14:21
  3. Replies: 3
    Last Post: 4th August 2010, 18:51
  4. Replies: 2
    Last Post: 13th April 2010, 16:50
  5. Filling combobox from database
    By Philip_Anselmo in forum Qt Programming
    Replies: 3
    Last Post: 11th May 2006, 17:53

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.