Results 1 to 3 of 3

Thread: Customizing Sorting

  1. #1
    Join Date
    Mar 2009
    Posts
    3
    Thanks
    2

    Default Customizing Sorting

    Hello,

    In QT3 I reimplement "compare" in my QListViewItem. But now in QT4, I am using QTreeWidgetItem and I don't know how to customize the sorting. I want to sort alphabetically except for one item in the tree that I always want at the end.

    How do I do that?

    Thanks.

    Marc-Andre

  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: Customizing Sorting

    derive your own item from QTreeWidgetItem and reimplement
    virtual bool operator< ( const QTreeWidgetItem & other ) const
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

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

    delalaym (12th March 2009)

  4. #3
    Join Date
    Mar 2008
    Location
    Houston, Texas, USA
    Posts
    277
    Thanks
    9
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: Customizing Sorting

    Qt-4.7.3 | Gentoo ~amd64 | KDE-4.7
    Aki IRC Client for KDE4 | Qt Documentation

  5. The following user says thank you to ComaWhite for this useful post:

    delalaym (12th March 2009)

Similar Threads

  1. Refresh QTableView after sorting
    By araglin in forum Newbie
    Replies: 4
    Last Post: 18th December 2008, 22:13
  2. Qt4: Sorting QAbstractItemVew inherited view
    By nando in forum Qt Programming
    Replies: 3
    Last Post: 12th February 2008, 18:30
  3. Column Sorting
    By sumsin in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2006, 07:48
  4. QT4: Sorting in QTreeWidget (subclass)
    By Michiel in forum Qt Programming
    Replies: 21
    Last Post: 29th March 2006, 18:08
  5. [QT4] QTreeView, QAbstractItemModel and sorting
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 24th March 2006, 20:16

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.