Results 1 to 5 of 5

Thread: Row index change when using QSortFilterProxyModel after sorting in QT4

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    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: Row index change when using QSortFilterProxyModel after sorting in QT4

    Ok, then I had get you wrong. Sorry.

    The Solution for your problem is pretty simple:
    Qt Code:
    1. QVariant MySortFilterProxyModel::headerData(int section, Qt::Orientation orientation, int role) const
    2. {
    3. if (role != Qt::DisplayRole)
    4. return QVariant();
    5. if (orientation == Qt::Horizontal)
    6. return QSortFilterProxyModel::headerData(section, orientation, role);
    7. return section + 1;
    8. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by Lykurg; 1st March 2011 at 08:45.

Similar Threads

  1. DockWidgetArea change and layout direction change
    By mstegehu in forum Qt Programming
    Replies: 1
    Last Post: 21st February 2012, 22:24
  2. Replies: 0
    Last Post: 7th October 2010, 20:38
  3. Readline from a particular index
    By giusepped in forum Qt Programming
    Replies: 5
    Last Post: 30th April 2010, 21:58
  4. Get Row Index
    By wirasto in forum Qt Programming
    Replies: 4
    Last Post: 13th September 2009, 14:57
  5. Get index of QValueListIterator
    By zlatko in forum Qt Programming
    Replies: 8
    Last Post: 17th February 2006, 11:27

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
  •  
Qt is a trademark of The Qt Company.