Unsolved Sorting in QtableView
-
Hi All
I have query in sorting a column in QtableView . One of the ways to sort a column in Qtableviewtry using QSortFilterProxyModel
an example:
@ QSortFilterProxyModel *sort_filter = new QSortFilterProxyModel(this);
sort_filter->setSourceModel(model);
sort_filter->sort (0);
this->ui->data_table->setModel (sort_filter);Now my question is is the best way to sort the column ?
Also when a sort the column does the QModelIndex of the each row changes or it remains the same
-
Hi,
That's the official way.
You should rather write a quick test to verify the index handling. That would have answered the question faster.