<?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[is It possible to know how the signal QStandardItemModel::itemChanged is triggered?]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Thers is a QStandardItemModel associated with a  QTableView in my case,  and the signal QStandardItemModel::itemChanged can be triggered in 2 different ways:</p>
<ol>
<li>Triggered by UI: User edits text of item from UI</li>
<li>Triggered by coding: Call item-&gt;setText() by coding directly, skipping UI.</li>
</ol>
<p dir="auto">How can I tell which is the true trigger? OR is there any other signal meeting that requirement? Any suggestion is appreciated. Thanks in advance.</p>
]]></description><link>https://forum.qt.io/topic/139422/is-it-possible-to-know-how-the-signal-qstandarditemmodel-itemchanged-is-triggered</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 14:15:22 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/139422.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Sep 2022 12:55:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to is It possible to know how the signal QStandardItemModel::itemChanged is triggered? on Fri, 23 Sep 2022 02:59:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a><br />
Good suggestion. I can't agree more.</p>
]]></description><link>https://forum.qt.io/post/729861</link><guid isPermaLink="true">https://forum.qt.io/post/729861</guid><dc:creator><![CDATA[Lee908]]></dc:creator><pubDate>Fri, 23 Sep 2022 02:59:51 GMT</pubDate></item><item><title><![CDATA[Reply to is It possible to know how the signal QStandardItemModel::itemChanged is triggered? on Tue, 20 Sep 2022 08:21:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lee908">@<bdi>Lee908</bdi></a><br />
Just so you are aware there is an alternative.  <em>Personally</em> I regard Qt's <code>blockSignals()</code> as devil-spawn, because it blocks all signals and fails to mention what the consequences of that <em>may</em> be to correct operation when you only really wish to block a single signal.</p>
<p dir="auto">You could set a variable for the duration of "loading" and release at the end instead.  That variable could be tested in the slot(s) for <code>itemChanged()</code> only and do nothing while set.  Just a thought.</p>
]]></description><link>https://forum.qt.io/post/729423</link><guid isPermaLink="true">https://forum.qt.io/post/729423</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 20 Sep 2022 08:21:28 GMT</pubDate></item><item><title><![CDATA[Reply to is It possible to know how the signal QStandardItemModel::itemChanged is triggered? on Tue, 20 Sep 2022 01:49:13 GMT]]></title><description><![CDATA[<p dir="auto">Figure out a way to solve my problem: block signal before loading data and release it after loading work is done.</p>
]]></description><link>https://forum.qt.io/post/729371</link><guid isPermaLink="true">https://forum.qt.io/post/729371</guid><dc:creator><![CDATA[Lee908]]></dc:creator><pubDate>Tue, 20 Sep 2022 01:49:13 GMT</pubDate></item><item><title><![CDATA[Reply to is It possible to know how the signal QStandardItemModel::itemChanged is triggered? on Tue, 20 Sep 2022 01:18:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> ，</p>
<p dir="auto">Thanks for your kindly suggestion.</p>
<p dir="auto">Actually, the reason I want to know the source of modification is :<br />
There are 2 table views A and B in my case. When user edit Table A via UI, setting a check box checked, QStandardItemModel::itemChanged would be emitted and inform of Table B to add a corresponding row. It works as expected. BUT when opening a file to read data, Table A and Table B are loaded respectively and I find there are many duplicated rows in Table B. The root cause is that when loading Table A, signal QStandardItemModel::itemChanged is also triggered.</p>
<p dir="auto">So I want to prevent that signal to add rows into Table B when load files. How can I use QStandardItem::setText() to solve this issue?</p>
]]></description><link>https://forum.qt.io/post/729370</link><guid isPermaLink="true">https://forum.qt.io/post/729370</guid><dc:creator><![CDATA[Lee908]]></dc:creator><pubDate>Tue, 20 Sep 2022 01:18:24 GMT</pubDate></item><item><title><![CDATA[Reply to is It possible to know how the signal QStandardItemModel::itemChanged is triggered? on Mon, 19 Sep 2022 15:11:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lee908">@<bdi>Lee908</bdi></a> said in <a href="/post/729298">is It possible to know how the signal QStandardItemModel::itemChanged is triggered?</a>:</p>
<blockquote>
<p dir="auto">How can I tell which is the true trigger?</p>
</blockquote>
<p dir="auto">You can't since the model does not know it since <a href="https://doc.qt.io/qt-6/qstandarditemmodel.html#setData" target="_blank" rel="noopener noreferrer nofollow ugc">QSIM::setData()</a> is called without a hint from where the modifcation came from (which would be pointless somehow - an enum with all possible entry methods? Why?)</p>
<p dir="auto">But since you call QStandardItem::setText() you know when the text is set programatically.</p>
]]></description><link>https://forum.qt.io/post/729321</link><guid isPermaLink="true">https://forum.qt.io/post/729321</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Mon, 19 Sep 2022 15:11:07 GMT</pubDate></item></channel></rss>