<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QSqlTableModel::setFilter order by _rowid_]]></title><description><![CDATA[<p dir="auto">I have <code>SQLite</code> table without <code>PRIMARY KEY</code>, shown in <code>QTableView</code>. When filter is not set, i get all records, for example</p>
<pre><code>field1   field2
---------------
item1    info1
item2    info2
item3    info3
item1    info4
...
</code></pre>
<p dir="auto">But when I set filter like <code>WHERE field1 IN ('item1', 'item2')</code> result is</p>
<pre><code>field1   field2
---------------
item1    info1
item1    info4
item2    info2
...
</code></pre>
<p dir="auto">Instead of wanted</p>
<pre><code>field1   field2
---------------
item1    info1
item2    info2
item1    info4
...
</code></pre>
<p dir="auto">As I understand I need to order result by <code>_rowid_</code>, but when I add <code>' ORDER BY _rowid_'</code> to filter, result is empty. How can I achieve ordering by <code>_rowid_</code>?</p>
]]></description><link>https://forum.qt.io/topic/96294/qsqltablemodel-setfilter-order-by-_rowid_</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 04:51:21 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/96294.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 05 Nov 2018 07:55:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QSqlTableModel::setFilter order by _rowid_ on Mon, 05 Nov 2018 10:09:11 GMT]]></title><description><![CDATA[<p dir="auto">If I use <code>QSortFilterProxyModel</code> with <code>QSqlRelationalTableModel</code>, i don't have <code>comboBox</code> editors for foreign keys<br />
I think the problem is with the <code>QTableView::setItemDelegate</code>, cause it expects model to be <code>QSqlRelationalTableModel</code>, not <code>QSortFilterProxyModel</code></p>
]]></description><link>https://forum.qt.io/post/491243</link><guid isPermaLink="true">https://forum.qt.io/post/491243</guid><dc:creator><![CDATA[Kot Shrodingera]]></dc:creator><pubDate>Mon, 05 Nov 2018 10:09:11 GMT</pubDate></item><item><title><![CDATA[Reply to QSqlTableModel::setFilter order by _rowid_ on Mon, 05 Nov 2018 08:21:29 GMT]]></title><description><![CDATA[<p dir="auto">Don't do it in sql but add a <a href="http://doc.qt.io/qt-5/qsortfilterproxymodel.html" target="_blank" rel="noopener noreferrer nofollow ugc">QSortFilterProxyModel</a></p>
]]></description><link>https://forum.qt.io/post/491227</link><guid isPermaLink="true">https://forum.qt.io/post/491227</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Mon, 05 Nov 2018 08:21:29 GMT</pubDate></item></channel></rss>