Results 1 to 4 of 4

Thread: QTreeWidget, setSortingEnabled

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: QTreeWidget, setSortingEnabled

    Quote Originally Posted by osiris81 View Post
    - What would be the easiest way to sort a column that has text and numbers, it should sort the numbers like 1, 5, 10, 20 and not 1, 10, 20, 5
    Then set nembers to your items, then they are sorted like you want them to. E.g. don't use:
    Qt Code:
    1. item->setText(4, "5");
    To copy to clipboard, switch view to plain text mode 
    use
    Qt Code:
    1. item->setData(4,Qt::DisplayRole, 5);
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to Lykurg for this useful post:

    Cupidvogel (30th April 2015)

  3. #2
    Join Date
    Nov 2008
    Posts
    21
    Thanked 1 Time in 1 Post

    Default Re: QTreeWidget, setSortingEnabled

    thanks a lot for your help, that helped me!

Similar Threads

  1. Qtreewidget
    By newermind in forum Qt Programming
    Replies: 1
    Last Post: 4th May 2009, 11:09
  2. Replies: 2
    Last Post: 17th March 2008, 12:53
  3. Replies: 1
    Last Post: 19th October 2007, 01:29
  4. QTableWidget - setSortingEnabled
    By bruccutler in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2007, 15:27
  5. QTreeWidget
    By allensr in forum Qt Programming
    Replies: 3
    Last Post: 14th November 2006, 16:24

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.