Hi,
Anyone knows how to limit number of rows shown in QTreeView with QSqlTableModel (or QSortFilterProxy) to some number (given by user)?
Hi,
Anyone knows how to limit number of rows shown in QTreeView with QSqlTableModel (or QSortFilterProxy) to some number (given by user)?
You have to run a level 3 diagnostic.
Ashes to ashes, Qt to Qt ( wysota )
in my case im adding LIMIT to setfilter()
note: you cannot directly add LIMIT to filter like setfileter("LIMIT 10"), adding Where clause will do the trick setfilter("Where yourdata not null LIMIT 10")..
thats my quick solution.
Thanks for your response. But it doesn't work for me. I get no rows at all when I add LIMIT to the filter.
You have to run a level 3 diagnostic.
Ashes to ashes, Qt to Qt ( wysota )
Hi all!
I think this happens because QSqlTableModel will call setSort after setFilter and this produces an Error (the LIMIT clause must be after any sorting clauses).
As far as I know, the only solutions are:
- Use QSqlQueryModel
- Subclass QSqlTableModel and implement the function (e.g implement the setQuery function)
I hope this can help.
Bookmarks