Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946
QSqlTableModel::setFilter order by _rowid_
-
I have
SQLite
table withoutPRIMARY KEY
, shown inQTableView
. When filter is not set, i get all records, for examplefield1 field2 --------------- item1 info1 item2 info2 item3 info3 item1 info4 ...
But when I set filter like
WHERE field1 IN ('item1', 'item2')
result isfield1 field2 --------------- item1 info1 item1 info4 item2 info2 ...
Instead of wanted
field1 field2 --------------- item1 info1 item2 info2 item1 info4 ...
As I understand I need to order result by
_rowid_
, but when I add' ORDER BY _rowid_'
to filter, result is empty. How can I achieve ordering by_rowid_
?
-
Don't do it in sql but add a QSortFilterProxyModel
-
If I use
QSortFilterProxyModel
withQSqlRelationalTableModel
, i don't havecomboBox
editors for foreign keys
I think the problem is with theQTableView::setItemDelegate
, cause it expects model to beQSqlRelationalTableModel
, notQSortFilterProxyModel