<?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[QSplitter: how to know when a widget is added&#x2F;removed form the splitter]]></title><description><![CDATA[<p dir="auto">Hello,<br />
Is there a signal sent on a widget's addition/removal to the splitter. I tried overriding the QObject::ChildEvent() but i noticed that the splitter count isn't updated when this event is been called(although its been called several times, there isn't a call after QSplitter::count() is updated).<br />
I want to do some updates on splitter on each widget's add/removal.</p>
<p dir="auto">Please see my second post in this thread for the work around.</p>
]]></description><link>https://forum.qt.io/topic/64454/qsplitter-how-to-know-when-a-widget-is-added-removed-form-the-splitter</link><generator>RSS for Node</generator><lastBuildDate>Wed, 13 May 2026 21:36:44 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/64454.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 22 Feb 2016 15:35:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QSplitter: how to know when a widget is added&#x2F;removed form the splitter on Mon, 22 Feb 2016 22:59:00 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for the reply <a class="plugin-mentions-user plugin-mentions-a" href="/user/joel-bodenmann">@<bdi>Joel-Bodenmann</bdi></a><br />
Yes i did call QSplitter::childEvent(event),</p>
<p dir="auto">but i think child event is getting called after widget reparenting &amp; also on polish events but not after QSplitter::count() is updated.</p>
<p dir="auto">Good thing is that i found a work around,</p>
<ul>
<li>I've reimplemented QSplitter::paintEvent() and doing "MAGIC" but i found that paintEvent is called too many times.</li>
<li>So, i'm storiing QSplitter::count() in a member variable &amp; updating it on every paintEvent(). With this i was able to "applyMagic()" only when    the splitter count() is actually changed.<br />
I think this isn't an ideal solution but all i need is to "applyMagic()" when the splitter is about to be shown after getting widgets added/removed. (manipulating Qt event handlers to solve our purposes..:) )</li>
</ul>
]]></description><link>https://forum.qt.io/post/314751</link><guid isPermaLink="true">https://forum.qt.io/post/314751</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Mon, 22 Feb 2016 22:59:00 GMT</pubDate></item><item><title><![CDATA[Reply to QSplitter: how to know when a widget is added&#x2F;removed form the splitter on Mon, 22 Feb 2016 21:48:49 GMT]]></title><description><![CDATA[<p dir="auto">I have never worked with QSplitter so I don't know if this is the problem or not, but did you make sure that you call the default implementation of the <code>QSplitter::childEvent()</code> method in your own override? Something like this:</p>
<pre><code>void MySplitter::childEvent(QChildEvent* c) {
	// Call the default implementation
	QSplitter::childEvent(c)

	// Do my own stuff here
	applyMagic();
}
</code></pre>
]]></description><link>https://forum.qt.io/post/314727</link><guid isPermaLink="true">https://forum.qt.io/post/314727</guid><dc:creator><![CDATA[Joel Bodenmann]]></dc:creator><pubDate>Mon, 22 Feb 2016 21:48:49 GMT</pubDate></item></channel></rss>