jtdavidson
7th August 2010, 07:07
I've been using an "Order By" clause in qsqltablemodel::setfilter, because i need to sort a table by two columns, and as far as I can tell qsqltablemodel::setSort only allows you to sort by one column.
Order By *does* work in setFilter, but is it supported? I've never seen it in the documentation. I ask because, if I assign to a qtableview a qsqltablemodel model that has an order by clause in its filter, and if that view has sorting enabled, then resorting using the view's sort function produces an empty view.
So I'm guessing that I shouldn't be using Order By in setFilter? Is there some other way to sort a tablemodel by 2 columns? I can't use a querymodel because they are read only, and I need to write to the sorted table.
thanks
John
Order By *does* work in setFilter, but is it supported? I've never seen it in the documentation. I ask because, if I assign to a qtableview a qsqltablemodel model that has an order by clause in its filter, and if that view has sorting enabled, then resorting using the view's sort function produces an empty view.
So I'm guessing that I shouldn't be using Order By in setFilter? Is there some other way to sort a tablemodel by 2 columns? I can't use a querymodel because they are read only, and I need to write to the sorted table.
thanks
John