<?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[model view rowCount]]></title><description><![CDATA[<p dir="auto">Hello!</p>
<p dir="auto">I am trying to understand the way in which Table Models work by doing the tutorials provided by Qt, I am facing the problem that I am not able to understand the following code lines:</p>
<pre><code>int rowCount(const QModelIndex &amp;parent = QModelIndex())const override;
</code></pre>
<p dir="auto">Your are declaring a method (rowCount) and passing it a const of type QModelIndex pointing to a memory address (&amp;parent) and why is equal to QModelIndex? for me this makes no sense, why pass a memory address to (neither know what parent really means or where it is, I guess it is the parent class).</p>
<p dir="auto">Can someone (please), explain me this code?</p>
<p dir="auto">Thank you!</p>
]]></description><link>https://forum.qt.io/topic/98769/model-view-rowcount</link><generator>RSS for Node</generator><lastBuildDate>Mon, 06 Apr 2026 14:32:19 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/98769.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 21 Jan 2019 21:58:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to model view rowCount on Mon, 21 Jan 2019 22:26:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jss193">@<bdi>jss193</bdi></a> said in <a href="/post/506214">model view rowCount</a>:</p>
<blockquote>
<p dir="auto">and passing it a const of type QModelIndex pointing to a memory address (&amp;parent)</p>
</blockquote>
<p dir="auto">This not an adress, it's a reference.<br />
rowCount is a abstract method you must implement in your QAbstractTableModel subclass.<br />
The parent ModelIndex is only relevant in a TreeView and not use  in a TableView.</p>
]]></description><link>https://forum.qt.io/post/506217</link><guid isPermaLink="true">https://forum.qt.io/post/506217</guid><dc:creator><![CDATA[mpergand]]></dc:creator><pubDate>Mon, 21 Jan 2019 22:26:57 GMT</pubDate></item><item><title><![CDATA[Reply to model view rowCount on Mon, 21 Jan 2019 22:20:12 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto"><code>parent</code> if not given when calling the function will contain an invalid index.</p>
]]></description><link>https://forum.qt.io/post/506216</link><guid isPermaLink="true">https://forum.qt.io/post/506216</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Mon, 21 Jan 2019 22:20:12 GMT</pubDate></item></channel></rss>