PDA

View Full Version : QTableView::sortByColumn locale-aware sorting



Matriarch
30th January 2010, 15:41
Hello!
Please, is there any way to tell QTableView::sortByColumn to use locale-aware sorting? I`m using QSqlTableModel to display table content. I`m from Czech Republic and I need to sort records like this:



nana
nána
nene



Thanks a lot for any suggestions

Matriarch
30th January 2010, 16:21
I am sorry for posting question before deeply search in documentation. This problem has very easy solution, otherwise I decided to left there my post with it:



QTableView *view = new QTableView(this);
QSqlTableModel *model = new QSqlTableModel(this);
// set table for model
QSortFilterProxyModel *sortProxyModel = new QSortFilterProxyModel(this);
sortProxyModel->setSortLocaleAware(true);
sortProxyModel->setSourceModel(model);
view->setModel(sortProxyModel);