<?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[How to identify boundingbox size changes in QGraphicsTextItem ?]]></title><description><![CDATA[<p dir="auto">While editing the content of QGraphicsTextItem, bounding box size changes. I need to perform some action , if bounding box size changes. I don't find any signal available in QGraphicsTextItem which gets emitted on bounding box change. Is there any other way to get update on boundingbox size changes ?</p>
]]></description><link>https://forum.qt.io/topic/140383/how-to-identify-boundingbox-size-changes-in-qgraphicstextitem</link><generator>RSS for Node</generator><lastBuildDate>Fri, 19 Jun 2026 10:32:29 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/140383.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 28 Oct 2022 09:26:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to identify boundingbox size changes in QGraphicsTextItem ? on Mon, 31 Oct 2022 11:53:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a><br />
[solved]</p>
<p dir="auto">Thanks. I have corrected it to,</p>
<p dir="auto">QGraphicsTextItem* textItem = new QGraphicsTextItem("New user");<br />
textItem-&gt;setFlag(QGraphicsItem::ItemIsMovable);<br />
textItem-&gt;setFlag(QGraphicsItem::ItemIsSelectable);<br />
textItem-&gt;setTextInteractionFlags(Qt::TextEditorInteraction);</p>
<p dir="auto">connect(textItem-&gt;document(), &amp;QTextDocument::contentsChanged, this, &amp;MainWindow::textcontentsChanged);</p>
<p dir="auto">It's working now.</p>
]]></description><link>https://forum.qt.io/post/734594</link><guid isPermaLink="true">https://forum.qt.io/post/734594</guid><dc:creator><![CDATA[Sridharan]]></dc:creator><pubDate>Mon, 31 Oct 2022 11:53:20 GMT</pubDate></item><item><title><![CDATA[Reply to How to identify boundingbox size changes in QGraphicsTextItem ? on Fri, 28 Oct 2022 11:06:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sridharan">@<bdi>Sridharan</bdi></a><br />
As <a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> says.  Which is why you should switch to <a href="https://wiki.qt.io/New_Signal_Slot_Syntax" target="_blank" rel="noopener noreferrer nofollow ugc">https://wiki.qt.io/New_Signal_Slot_Syntax</a>.  It's not even "new" now, the syntax you are using is like a decade old, and is the cause of exactly this kind of error, which we have to keep pointing out to people when they get it wrong over and over....</p>
]]></description><link>https://forum.qt.io/post/734383</link><guid isPermaLink="true">https://forum.qt.io/post/734383</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Fri, 28 Oct 2022 11:06:21 GMT</pubDate></item><item><title><![CDATA[Reply to How to identify boundingbox size changes in QGraphicsTextItem ? on Fri, 28 Oct 2022 11:01:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sridharan">@<bdi>Sridharan</bdi></a> Of course you do not get compiler error!<br />
That's why I said that you should switch to Qt5 connect syntax!</p>
<p dir="auto">Again, do you see the issue here: connect(document, SIGNAL(contentsChanged()), this, SLOT(textcontentsChanged)); ?</p>
]]></description><link>https://forum.qt.io/post/734380</link><guid isPermaLink="true">https://forum.qt.io/post/734380</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 28 Oct 2022 11:01:47 GMT</pubDate></item><item><title><![CDATA[Reply to How to identify boundingbox size changes in QGraphicsTextItem ? on Fri, 28 Oct 2022 11:01:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a><br />
No compilation error. Problem is my slot function is not executed when i modify text</p>
]]></description><link>https://forum.qt.io/post/734379</link><guid isPermaLink="true">https://forum.qt.io/post/734379</guid><dc:creator><![CDATA[Sridharan]]></dc:creator><pubDate>Fri, 28 Oct 2022 11:01:13 GMT</pubDate></item><item><title><![CDATA[Reply to How to identify boundingbox size changes in QGraphicsTextItem ? on Fri, 28 Oct 2022 10:57:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sridharan">@<bdi>Sridharan</bdi></a> said in <a href="/post/734377">How to identify boundingbox size changes in QGraphicsTextItem ?</a>:</p>
<blockquote>
<p dir="auto">connect(document, SIGNAL(contentsChanged()), this, SLOT(textcontentsChanged));</p>
</blockquote>
<p dir="auto">Do you see what is wrong here?<br />
You should use Qt5 connect syntax to get compiler errors if your connect statement is wrong.</p>
]]></description><link>https://forum.qt.io/post/734378</link><guid isPermaLink="true">https://forum.qt.io/post/734378</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 28 Oct 2022 10:57:13 GMT</pubDate></item><item><title><![CDATA[Reply to How to identify boundingbox size changes in QGraphicsTextItem ? on Fri, 28 Oct 2022 10:51:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a></p>
<p dir="auto">I have tried idea provided in your 1st link, connect contentsChanged() signal to my own slot ( textcontentsChanged ) . By my slot is not getting executed. Attached my code below, anything wrong here ?</p>
<pre><code>QGraphicsTextItem* textItem = new QGraphicsTextItem("New user");
textItem-&gt;setFlag(QGraphicsItem::ItemIsMovable);
textItem-&gt;setFlag(QGraphicsItem::ItemIsSelectable);
textItem-&gt;setTextInteractionFlags(Qt::TextEditorInteraction);

QTextDocument* document = textItem-&gt;document();
connect(document, SIGNAL(contentsChanged()), this, SLOT(textcontentsChanged));
</code></pre>
]]></description><link>https://forum.qt.io/post/734377</link><guid isPermaLink="true">https://forum.qt.io/post/734377</guid><dc:creator><![CDATA[Sridharan]]></dc:creator><pubDate>Fri, 28 Oct 2022 10:51:22 GMT</pubDate></item><item><title><![CDATA[Reply to How to identify boundingbox size changes in QGraphicsTextItem ? on Fri, 28 Oct 2022 09:50:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sridharan">@<bdi>Sridharan</bdi></a><br />
Since I see various <code>...Changed()</code> signals for e.g. position change but not size change, I can only think: save the item/bounding box size before the editing, compare it after the editing, emit your own signal if they are different?</p>
<p dir="auto">See also <a href="https://forum.qt.io/topic/17811/detecting-when-a-qgraphicsitem-s-boundingrect-has-changed">Detecting when a QGraphicsItem's boundingRect has changed</a> or <a href="https://stackoverflow.com/questions/40162720/qgraphicsitemitemchange-notified-for-position-change-but-not-for-size-change" target="_blank" rel="noopener noreferrer nofollow ugc">QGraphicsItem::itemChange notified for position change but not for size change</a>, but I don't think they tell anything different.</p>
]]></description><link>https://forum.qt.io/post/734372</link><guid isPermaLink="true">https://forum.qt.io/post/734372</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Fri, 28 Oct 2022 09:50:20 GMT</pubDate></item></channel></rss>