PDA

View Full Version : Extra empty rows in QTableView when sorting columns



tehman
15th June 2012, 07:23
Hello!

I am working with QTableView and its model is a subclass of QAbstractTableModel. I have to sort columns on the tableview. I do that by SQL queries (ORDER BY). So when sorting I refresh my model. When I click on the tableview headers there is sorting but there are also extra empty rows in the bottom of the tableview that cannot be selected by mouse click. When you click again on the headers these extra rows are disappearing one by one (with one new click one empty row disappears). What can I do to solve this problem? I have googled the issue but there are no results. Please, help me.

ChrisW67
15th June 2012, 08:02
The model is broken but we have no way of telling you how.

tehman
15th June 2012, 08:21
Thank you for the reply. You mean it is a kind of bug in Qt?

ChrisW67
15th June 2012, 23:38
No, I mean it is a kind of bug in your code. You tell us "its model is a subclass of QAbstractTableModel", which means you have written your own model. Since the view is standard and faithfully does what the model tells it to the model must be defective in some way. We have no way to tell you how your model is broken because we cannot see it.

tehman
18th June 2012, 08:31
Yup, I get it. I decided to use QSortFilterProxyModel and that solved my problem.