Results 1 to 7 of 7

Thread: sorting Data in QTable

  1. #1
    Join Date
    Jul 2009
    Posts
    36
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default sorting Data in QTable

    hi...
    I'm successfully inserting data in QTable.
    I'm having 12 column.

    In 1 column i'm storing QDate in Qstring format.

    the question is can i sort the table through Datewise.

    this is code which is working perfectly while sorting table with integer.

    Qt Code:
    1. tableWidget->sortByColumn(4,Qt::DescendingOrder);
    To copy to clipboard, switch view to plain text mode 
    Last edited by sosanjay; 23rd October 2009 at 12:38.

  2. #2
    Join Date
    Jul 2009
    Posts
    36
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: sorting Data in QTable

    Can anyone tell me that
    How I sort the table data in Datewise or Current Timewise?

  3. #3
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: sorting Data in QTable

    I suppose Qt is sorting on strings in your tables, so that won't work obviously. I have no real experience with this, but perhaps you can insert a hidden column, assign each column a numerical value for each date, and sort using the hidden column?

  4. #4
    Join Date
    Jul 2009
    Posts
    36
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: sorting Data in QTable

    Can you send me the snippets code example of Hidden Column.
    Actually I am working on TableWidgets first time so I have not so much idea.

    Please send me some useful link or data.

  5. #5
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: sorting Data in QTable

    I have no snippets on hidden column. Check out the docs for qtableview.

  6. #6
    Join Date
    Jan 2008
    Location
    Bengaluru
    Posts
    144
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: sorting Data in QTable


  7. #7
    Join Date
    Oct 2006
    Posts
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: sorting Data in QTable

    Try to use the date ansi format that is:

    YYYYMMDD

    YYYYY = year
    MM = month
    DD = day

    its the best way for sorting date.
    Take a look to QDate class

Similar Threads

  1. QTable Sorting
    By mromey in forum Qt Programming
    Replies: 1
    Last Post: 23rd April 2009, 08:28
  2. Best way to display lots of data fast
    By New2QT in forum Newbie
    Replies: 4
    Last Post: 16th October 2008, 23:46
  3. how to access QCheckTableItem data with in a QTable.
    By ashukla in forum Qt Programming
    Replies: 1
    Last Post: 15th September 2007, 12:55
  4. Displaying data in QTable
    By raghvendramisra in forum Qt Tools
    Replies: 1
    Last Post: 6th September 2007, 13:48
  5. QTable - Data Base Problem
    By esq in forum Qt Tools
    Replies: 9
    Last Post: 28th May 2007, 00:08

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.