<?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[Some questions about the QAbstractTableModel dataChanged signal]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">in my project centered around tableviews and abstracttablemodels, whose number is being determined by loading some json-data, i have some rows consisting of boolean values. The ones set to "true" get counted and displayed in the last row but the result will not be shown, because I somehow can't figure out the correct syntax for it. I suppose that usually only one cell is being updated, when the signal from the setData function is being emitted  like this:</p>
<pre><code>emit dataChanged(index, index); 
</code></pre>
<p dir="auto">But I want to be able to also display the value on the same column and the last line, so something like:</p>
<pre><code>emit dataChanged(index(row, col), index(lastRow, col)); ```

</code></pre>
<p dir="auto">should work. But I encounter a "No matching call error".</p>
<p dir="auto">The other question is related to the first. For some of the boolean columns i'd like to know how many cells are being set to true regarding all tableviews / abstracttablemodels. What might be the best way to achieve this? Connecting to the dataChanged signals of all the other models? Or would it be more suitable to add a custom signal?</p>
<p dir="auto">Kind regards,</p>
<p dir="auto">Andreas</p>
]]></description><link>https://forum.qt.io/topic/127133/some-questions-about-the-qabstracttablemodel-datachanged-signal</link><generator>RSS for Node</generator><lastBuildDate>Sun, 28 Jun 2026 14:08:45 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/127133.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 30 May 2021 14:37:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Some questions about the QAbstractTableModel dataChanged signal on Sun, 30 May 2021 19:01:00 GMT]]></title><description><![CDATA[<p dir="auto">It depends on what you want to do...</p>
]]></description><link>https://forum.qt.io/post/662443</link><guid isPermaLink="true">https://forum.qt.io/post/662443</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Sun, 30 May 2021 19:01:00 GMT</pubDate></item><item><title><![CDATA[Reply to Some questions about the QAbstractTableModel dataChanged signal on Sun, 30 May 2021 18:29:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> Thanks for the clarification. Anyway, there're examples on the internet that seem to suggest that one could also use the parameter of setData() in order to obtain the same thing.</p>
]]></description><link>https://forum.qt.io/post/662430</link><guid isPermaLink="true">https://forum.qt.io/post/662430</guid><dc:creator><![CDATA[andi456]]></dc:creator><pubDate>Sun, 30 May 2021 18:29:59 GMT</pubDate></item><item><title><![CDATA[Reply to Some questions about the QAbstractTableModel dataChanged signal on Sun, 30 May 2021 17:41:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andi456">@<bdi>andi456</bdi></a> said in <a href="/post/662416">Some questions about the QAbstractTableModel dataChanged signal</a>:</p>
<blockquote>
<p dir="auto">I don't now why i cannot  use the parameter of the function itself,</p>
</blockquote>
<p dir="auto">The one is a parameter of type QModelIndex, the other a function from <a href="https://doc.qt.io/qt-5/qabstractitemmodel.html#index" target="_blank" rel="noopener noreferrer nofollow ugc">QAbstractItemModel</a>.</p>
]]></description><link>https://forum.qt.io/post/662420</link><guid isPermaLink="true">https://forum.qt.io/post/662420</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Sun, 30 May 2021 17:41:20 GMT</pubDate></item><item><title><![CDATA[Reply to Some questions about the QAbstractTableModel dataChanged signal on Sun, 30 May 2021 18:24:53 GMT]]></title><description><![CDATA[<p dir="auto">Ok, after a look into the documentation, i could solve the first question. I added a local QModelIndex() and assigned the index variable of the model to it:</p>
<pre><code>code_t QModelIndex bottomRight = this-&gt;index(lastRow, col, QModelIndex());
</code></pre>
<p dir="auto">I don't know why i cannot  use the parameter of the function itself, because i found a lot of examples suggesting just that. Anyway, the dataChanged function now works as expected and looks like this in my case:</p>
<pre><code>emit dataChanged(index, bottomRight);
</code></pre>
]]></description><link>https://forum.qt.io/post/662416</link><guid isPermaLink="true">https://forum.qt.io/post/662416</guid><dc:creator><![CDATA[andi456]]></dc:creator><pubDate>Sun, 30 May 2021 18:24:53 GMT</pubDate></item><item><title><![CDATA[Reply to Some questions about the QAbstractTableModel dataChanged signal on Sun, 30 May 2021 16:18:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> well it should be the index parameter of setData(const QModelIndex &amp;index, const QVariant &amp;value, int role), i suppose. Or should I declare another QModelIndex locally?</p>
<p dir="auto">Regarding the connection to the dataChanged signals, i must think about how to avoid too much confusion, because, if one value changes, all the other tables must be affected....</p>
]]></description><link>https://forum.qt.io/post/662408</link><guid isPermaLink="true">https://forum.qt.io/post/662408</guid><dc:creator><![CDATA[andi456]]></dc:creator><pubDate>Sun, 30 May 2021 16:18:39 GMT</pubDate></item><item><title><![CDATA[Reply to Some questions about the QAbstractTableModel dataChanged signal on Sun, 30 May 2021 14:58:48 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Any chance you have a local variable named index and that you are trying to call the function of the same name ?</p>
<p dir="auto">As your multiple models, yes, you can connect to the dataChanged signal and only act if the change includes one or more of your Boolean column.</p>
]]></description><link>https://forum.qt.io/post/662399</link><guid isPermaLink="true">https://forum.qt.io/post/662399</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Sun, 30 May 2021 14:58:48 GMT</pubDate></item></channel></rss>