View Full Version : QTableWidget sorting
losiem
14th July 2008, 18:17
Hi
I want to have QTableWidget sorted according to polish language. I have the parent window set to polish/Poland but QTableWidget is sorting wrong. What should I set else ?
thanks
Ryszard
caduel
14th July 2008, 19:01
what do you mean by
I have the parent window set to polish/Poland
How did you do that?
Show us some code, please.
You may reimplement QTableWidgetItem::operator<() (http://doc.trolltech.com/4.4/qtablewidgetitem.html#operator-lt) if you want to have custom sorting.
losiem
14th July 2008, 19:11
I can see that in properties table of window in Designer. locale: language:Polish, country:Poland.
I thik this is default setting in my system.
But I also tried add
setLocale(QLocale(QLocale::Polish,QLocale::Poland) );
into constructor of my window. Without effect.
wysota
14th July 2008, 20:20
Do what J-P suggested. You are observing the effect because the sorting is based not on the widget that displays the content, but on QString that is kept in the model that the widget uses and QStrings are compared according to C locale. You need to compare using QLocale to have the proper order.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.