<?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[QSqlQueryModel: how to insert column]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I have a TableView and I get the data from the database with a QSqlQueryModel. This works; the data is displayed.<br />
Now I want to add an additional column automatically (not: "insertColumns(0,1)" in the mainwindow.cpp).  I know, this will not insert the column in the database. It should be inserted only in the view.</p>
<p dir="auto">I only found out how to add a column at the end:</p>
<pre><code>int subclass::columnCount(const QModelIndex &amp;parent) const
{
    return QSqlQueryModel:: columnCount(parent) +1;

}
</code></pre>
<p dir="auto">However, I want the the new column at the beginning of the table.<br />
How can I do this?</p>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.qt.io/topic/130778/qsqlquerymodel-how-to-insert-column</link><generator>RSS for Node</generator><lastBuildDate>Sat, 15 Aug 2026 04:13:44 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/130778.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 02 Oct 2021 15:11:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QSqlQueryModel: how to insert column on Sat, 02 Oct 2021 16:10:32 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Use the KDE's <a href="https://api.kde.org/frameworks/kitemmodels/html/classKExtraColumnsProxyModel.html" target="_blank" rel="noopener noreferrer nofollow ugc">KExtraColumnProxyModel</a>.</p>
]]></description><link>https://forum.qt.io/post/683195</link><guid isPermaLink="true">https://forum.qt.io/post/683195</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Sat, 02 Oct 2021 16:10:32 GMT</pubDate></item></channel></rss>