<?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[Passing QSqlTableModel by value]]></title><description><![CDATA[<p dir="auto">Hello Guys,</p>
<p dir="auto">How can pass a QSqlTableModel to a function by Value not by Reference?</p>
<p dir="auto">ERROR!</p>
<pre><code>QSqlTableModel model;

foo(model);

void foo(QSqlTableModel){
....
}
</code></pre>
<p dir="auto">WORK BUT NOT GOOD FOR ME:</p>
<pre><code>QSqlTableModel *model;

foo(*model);

void foo(QSqlTableModel){
....
}
</code></pre>
<p dir="auto">I do not want to use pointer for passing a "model" as it will create a reference in heap like this:</p>
<p dir="auto"><a class="plugin-mentions-group plugin-mentions-a" href="/groups/qt-champions-2016">@<bdi>Qt-Champions-2016</bdi></a></p>
<p dir="auto"><em>[Edit: Added code tags ~kshegunov]</em></p>
]]></description><link>https://forum.qt.io/topic/87117/passing-qsqltablemodel-by-value</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 16:21:00 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/87117.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 23 Jan 2018 19:32:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Passing QSqlTableModel by value on Wed, 24 Jan 2018 01:48:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hasan-vaez">@<bdi>Hasan-Vaez</bdi></a> Why don't you want to use the heap? It is a good and useful thing.</p>
]]></description><link>https://forum.qt.io/post/438228</link><guid isPermaLink="true">https://forum.qt.io/post/438228</guid><dc:creator><![CDATA[JKSH]]></dc:creator><pubDate>Wed, 24 Jan 2018 01:48:14 GMT</pubDate></item><item><title><![CDATA[Reply to Passing QSqlTableModel by value on Tue, 23 Jan 2018 20:24:12 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">How can pass a QSqlTableModel to a function by Value not by Reference?</p>
</blockquote>
<p dir="auto">You can't. <code>QSqlTableModel</code> inherits <code>QObject</code> which means it can't be copied, thus it can't be passed by value.</p>
<blockquote>
<p dir="auto">I do not want to use pointer for passing a "model" as it will create a reference in heap like this:<br />
<a class="plugin-mentions-group plugin-mentions-a" href="/groups/qt-champions-2016">@<bdi>Qt-Champions-2016</bdi></a></p>
</blockquote>
<p dir="auto">Don't do that, please. I don't appreciate being summoned like this.</p>
]]></description><link>https://forum.qt.io/post/438199</link><guid isPermaLink="true">https://forum.qt.io/post/438199</guid><dc:creator><![CDATA[kshegunov]]></dc:creator><pubDate>Tue, 23 Jan 2018 20:24:12 GMT</pubDate></item></channel></rss>