[Interest] Sorting numbers in QSortFilterProxyModel with QSqlTableModel source

resurrection at centrum.cz resurrection at centrum.cz
Sat Nov 1 08:26:38 CET 2014


By default QSortFilterProxyModel can sort few different types using QVariant::type to see what is in it to do the correct sort. However when the QSqlTableModel is used then this always evaluates to QString (the default) and thus sorts numbers as strings. I wrote my own subclass of the filter model to force sorting by number but I wonder if there is a way to tell the QSortFilterProxyModel by what type it should sort? I know that the problem is obviously with QSqlTableModel disregarding the types of fields in the database but that is hardly something that could be influenced that easily.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20141101/a40d5ee9/attachment.html>


More information about the Interest mailing list