I i am Chinese, so my english is not good :
how can i use QSqlTableModel and QTableView set limit for sqlite? like select * from table limit x,y?
I i am Chinese, so my english is not good :
how can i use QSqlTableModel and QTableView set limit for sqlite? like select * from table limit x,y?
For read-only model you can use a QSqlQueryModel and a query "select * from mytable order by mycolumn limit 5"
langziyang (15th October 2010)
You can write your own read-write model based on the QSqlQueryModel (like QSqlTableModel) but you will have some things to sort out. For example, what happens if the user edits a row and it no longer qualifies for the "top n" query?
You might also be able to use QSortFilterProxyModel on top of a QSqlTableModel (no limit) to present only the first n rows to a view and still be able to edit.
Bookmarks