Results 1 to 3 of 3

Thread: QListView::setIndexWidget custom sorting

  1. #1
    Join Date
    May 2010
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default QListView::setIndexWidget custom sorting

    Hello!

    I have the QListView widget and add my custom widget (QLabel and QPushButton placed on QHBoxLayout) with setIndexWidget().
    Is it possible to overload any method of QListView to specify sorting function?

    I was trying to use QSortFilterProxyModel but I'm not sure of how to link my custom widget with QModelIndex.

    Thanks.

  2. #2
    Join Date
    Apr 2010
    Posts
    34
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QListView::setIndexWidget custom sorting

    I'd recommend to apply all kinds of sorting using a model.
    Can you be more specific with the relations between the QListView, your custom widget and data you want to fill them with? Maybe some code with definitions?

  3. #3
    Join Date
    May 2010
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QListView::setIndexWidget custom sorting

    Quote Originally Posted by Vit Stepanek View Post
    I'd recommend to apply all kinds of sorting using a model.
    Can you be more specific with the relations between the QListView, your custom widget and data you want to fill them with? Maybe some code with definitions?
    Well, I add buttons to the QListView and want them to be sorted in the column using their text() value. How could it be implemented in general?
    I found many examples if placing just strings to cells in QTreeView or QTableView. But how to deal with widgets (and sorting ) beeing inserted into the cell ?

Similar Threads

  1. add custom widget items to QListView or QListWidget
    By yazwas in forum Qt Programming
    Replies: 2
    Last Post: 16th September 2010, 22:36
  2. Sorting in QListView class
    By Yayati.Ekbote in forum Qt Programming
    Replies: 5
    Last Post: 14th April 2010, 12:26
  3. QListView and custom widgets in each cell
    By T4ng10r in forum Qt Programming
    Replies: 1
    Last Post: 28th December 2009, 10:14
  4. QListView sorting
    By fear in forum Qt Programming
    Replies: 14
    Last Post: 21st August 2007, 13:08
  5. How can I disable the QListView Sorting?
    By darpan in forum Qt Programming
    Replies: 3
    Last Post: 27th June 2006, 10:36

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.