I have a QTableView
whose data model is a class derived from QSortFilterProxyModel
that I have created myself. In this class we reimplemented the method filterAcceptsRow
to be able to filter the data of the table according to several criteria. I can also sort the table by any of the fields in it.
The problem arises when the user clicks the "Create" button, which creates a new empty row in the table. If I have a filter applied, the empty row does not appear because it does not meet this filter, which I do not want to happen because the user has to start to edit their data obligatorily.
Also, when I have the table ordered by a field, when I add the empty row, it automatically positions itself in the position that it plays according to the sorting criteria, which is not desirable because I want it always to be in the first position.
Any idea how you can fix this problem?
QTableView::setSortingEnabled(false)
and enable it latter. – vahancho