VSRonin / QtModelUtilities

A set of utilities for the model/view framework of Qt
Apache License 2.0
23 stars 5 forks source link

InsertProxyModel makes disabling sort impossible once enabled #46

Closed deanljohnson closed 3 years ago

deanljohnson commented 3 years ago

Hello - first, thank you for the library.

InsertProxyModel::sort currently returns early if the sort column is invalid. This makes it impossible to disable the sorting on a source model once any has been applied. Usually I do something like ui->tableView->sortByColumn(-1, Qt::SortOrder::AscendingOrder) but that doesn't work when using with InsertProxyModel because the proxy prevents the sort call from getting to the source model..

VSRonin commented 3 years ago

This is undocumented behaviour. QStandardItemModel also returns if the column is invalid. I see however that what you are asking is technically valid for QSqlTableModel