<?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[Exposing signal of the embedded QWidget]]></title><description><![CDATA[<p dir="auto">Hello everyone,</p>
<p dir="auto">Is there any nice way of exposing the signal of the embedded private member (in my case the MyWidget, which stays private, I am adding it with Qt Designer), so that it will be possible to connect to its signal from the outside (e.g. MainWindow)? I guess that would brake the encapsulation, but maybe there is a nicer way, than exposing it like this:</p>
<pre><code>QObject::connect(my_widget, &amp;MyWidget::my_signal, this, &amp;MyDialog::my_signal);
</code></pre>
<p dir="auto">Here MyWidget is embedded into MyDialog and its signal has to be accessed from the outside (from MainWindow) to connect.</p>
<p dir="auto">With this solution it will be possible to connect to 'my_signal' of MyDialog instead of directly connecting to the signal of the private 'my_widget' as the walkaround. The obvious issue is the additional code while exposing all the necessary signals every signal time I am embedding this MyWidget in any form.</p>
<p dir="auto">Thank you for any hints!</p>
]]></description><link>https://forum.qt.io/topic/90794/exposing-signal-of-the-embedded-qwidget</link><generator>RSS for Node</generator><lastBuildDate>Wed, 24 Jun 2026 12:52:17 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/90794.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 16 May 2018 20:54:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Exposing signal of the embedded QWidget on Sat, 19 May 2018 02:14:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jendker">@<bdi>Jendker</bdi></a> said in <a href="/post/459065">Exposing signal of the embedded QWidget</a>:</p>
<blockquote>
<p dir="auto">I don't have that much signals to expose. I was just considering how to act in the future if the Widget would get more complex and will be careful with the design.</p>
</blockquote>
<p dir="auto">When your widget grows in complexity, take the time to figure out how to logically split it into a multiple smaller, independent widgets. The benefits are:</p>
<ul>
<li>You can unit-test each widget independently</li>
<li>Each widget doesn't have that many signals to expose</li>
</ul>
]]></description><link>https://forum.qt.io/post/459095</link><guid isPermaLink="true">https://forum.qt.io/post/459095</guid><dc:creator><![CDATA[JKSH]]></dc:creator><pubDate>Sat, 19 May 2018 02:14:20 GMT</pubDate></item><item><title><![CDATA[Reply to Exposing signal of the embedded QWidget on Fri, 18 May 2018 20:08:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> Thanks for the advice! In this case I wanted restrain myself to the solution from my first post which <a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> has recommended, I don't have that much signals to expose. I was just considering how to act in the future if the Widget would get more complex and will be careful with the design.</p>
<p dir="auto">Thanks guys one more time for the help! I appreciate it.</p>
]]></description><link>https://forum.qt.io/post/459065</link><guid isPermaLink="true">https://forum.qt.io/post/459065</guid><dc:creator><![CDATA[Jendker]]></dc:creator><pubDate>Fri, 18 May 2018 20:08:26 GMT</pubDate></item><item><title><![CDATA[Reply to Exposing signal of the embedded QWidget on Fri, 18 May 2018 19:49:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jendker">@<bdi>Jendker</bdi></a><br />
Well careful!  I never <em>advised</em> this, I only <em>mentioned</em> it :)<br />
It will let you get lots of things done quickly, but dirtily.<br />
Providing proper wrappers like <a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> said is the proper way.<br />
We don't know whether you're part of  company or a one-man band!<br />
It's up to you :)</p>
]]></description><link>https://forum.qt.io/post/459061</link><guid isPermaLink="true">https://forum.qt.io/post/459061</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Fri, 18 May 2018 19:49:39 GMT</pubDate></item><item><title><![CDATA[Reply to Exposing signal of the embedded QWidget on Fri, 18 May 2018 19:24:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> Thank you, of course you are right, I will keep it in mind :) I have no idea why didn't I think about it. I guess this is the reason why you should avoid programming late in the night...</p>
]]></description><link>https://forum.qt.io/post/459059</link><guid isPermaLink="true">https://forum.qt.io/post/459059</guid><dc:creator><![CDATA[Jendker]]></dc:creator><pubDate>Fri, 18 May 2018 19:24:06 GMT</pubDate></item><item><title><![CDATA[Reply to Exposing signal of the embedded QWidget on Thu, 17 May 2018 19:40:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jendker">@<bdi>Jendker</bdi></a><br />
Writing a public accessor which returns the private MyWidget to the outside world lets them call anything they like on it with barely any effort....</p>
<p dir="auto">Of course, as <a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a>  says you're supposed to expose each signal or property on a case-by-case basis :)</p>
]]></description><link>https://forum.qt.io/post/458857</link><guid isPermaLink="true">https://forum.qt.io/post/458857</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Thu, 17 May 2018 19:40:45 GMT</pubDate></item><item><title><![CDATA[Reply to Exposing signal of the embedded QWidget on Wed, 16 May 2018 22:21:42 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">That's the correct way of doing it.</p>
<p dir="auto">If you have that many signals to forward that it becomes cumbersome then you might want to rethink the design of your widget.</p>
]]></description><link>https://forum.qt.io/post/458682</link><guid isPermaLink="true">https://forum.qt.io/post/458682</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 16 May 2018 22:21:42 GMT</pubDate></item></channel></rss>