PDA

View Full Version : QListView::setIndexWidget custom sorting



drus
23rd June 2010, 10:04
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.

Vit Stepanek
24th June 2010, 15:26
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?

drus
10th December 2010, 08:52
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 ?