Results 1 to 4 of 4

Thread: How can I disable the QListView Sorting?

  1. #1
    Join Date
    Mar 2006
    Posts
    47
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default How can I disable the QListView Sorting?

    Hi,
    I want to disable the QlisView's sorting, My requirement is to appear the text in the order as i enter in qlistview, i want to disable the default sorting of qlistview.

    Thanks and Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can I disable the QListView Sorting?

    Assuming that you use Qt3, you need this:
    void QListView::setSorting ( int column, bool ascending = TRUE ) [virtual]
    Sets the list view to be sorted by column column in ascending order if ascending is TRUE or descending order if it is FALSE.
    If column is -1, sorting is disabled and the user cannot sort columns by clicking on the column headers. If column is larger than the number of columns the user must click on a column header to sort the list view.

  3. #3
    Join Date
    Mar 2006
    Posts
    47
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: How can I disable the QListView Sorting?

    Hi,

    I am able to disable listview sorting but i also want to show items in the order as they inserted in the qlistview.

    I want to make log report of my application. How can i show the items according to order as they inserted in the qlistview.

    Thanks and Regards

  4. #4
    Join Date
    Jun 2006
    Posts
    11
    Thanked 4 Times in 4 Posts

    Default Re: How can I disable the QListView Sorting?

    Use the after-argument when constructing the items:
    Qt Code:
    1. QListViewItem::QListViewItem ( QListView * parent, QListViewItem * after )
    To copy to clipboard, switch view to plain text mode 
    Combine this with
    Qt Code:
    1. QListViewItem * QListView::lastItem () const
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Column Sorting
    By sumsin in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2006, 07:48
  2. QT4: Sorting in QTreeWidget (subclass)
    By Michiel in forum Qt Programming
    Replies: 21
    Last Post: 29th March 2006, 18:08
  3. [QT4] QTreeView, QAbstractItemModel and sorting
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 24th March 2006, 20:16
  4. QListView
    By dragon in forum Newbie
    Replies: 1
    Last Post: 25th January 2006, 21:08
  5. Keeping focus at bottom of QListView
    By jakamph in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2006, 14:45

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.