<?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[Passing messages between objects - alternative to &quot;connect&quot; ?]]></title><description><![CDATA[<p dir="auto">This is kinda of followup  on another thread ....</p>
<p dir="auto">I am looking for an alternative to pass messages between objects.</p>
<p dir="auto">How is this for an idea ?</p>
<p dir="auto">Build / create QT "standard "  QT Designer Form Class - let's call it "parent class " -  for   this  discussion (only).<br />
Build / create QT "standard "  QT Designer Form Class - let's call it "child class " - for  this  discussion (only).<br />
Add the "child  class " as a member of the "parent class".</p>
<p dir="auto">Both classes have standard Qt form feature, each one accessible from  corresponding class.</p>
<p dir="auto">Is there a reasonably   straight forward way to enable "parent" to access the child form ?</p>
<p dir="auto">Ideally the changes in "child " form needs to be passed onto the "parent",  and it would not be necessary to actually show the "child"  form.</p>
<p dir="auto">PS I did try "inheritance"  but there in no easy way to inherit /add  "form  class "  to primary form  class...</p>
<p dir="auto">.</p>
]]></description><link>https://forum.qt.io/topic/142188/passing-messages-between-objects-alternative-to-connect</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Apr 2026 10:12:27 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/142188.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 13 Jan 2023 18:54:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Passing messages between objects - alternative to &quot;connect&quot; ? on Sat, 14 Jan 2023 00:44:08 GMT]]></title><description><![CDATA[<p dir="auto">the answer the question based on post title, there are many possibilities to have "objects" communicate with each other but why reinvent the wheel?  anything custom will need to be rigorously proven, especially with regard to object syncronization.  the signal/slot mechanism already takes care of the heavy lifting.  The only time I'd entertain a custom object communications channel would be when IPC (interprocess communications) is necessary, or processes/objects running in their own address space...and then I'd try to choose a high level API that already exists: message queues, fifos, sockets, etc.</p>
]]></description><link>https://forum.qt.io/post/743824</link><guid isPermaLink="true">https://forum.qt.io/post/743824</guid><dc:creator><![CDATA[Kent-Dorfman]]></dc:creator><pubDate>Sat, 14 Jan 2023 00:44:08 GMT</pubDate></item><item><title><![CDATA[Reply to Passing messages between objects - alternative to &quot;connect&quot; ? on Fri, 13 Jan 2023 21:12:41 GMT]]></title><description><![CDATA[<p dir="auto">@AnneRanch said in <a href="/post/743803">Passing messages between objects - alternative to "connect" ?</a>:</p>
<blockquote>
<p dir="auto">I am looking for an alternative to pass messages between objects.</p>
</blockquote>
<p dir="auto">You can use custom event,<br />
Define your own events and send them with:<br />
[static] bool QCoreApplication::sendEvent(QObject *receiver, QEvent *event)</p>
<blockquote>
<p dir="auto">Sends event event directly to receiver receiver, using the notify() function. Returns the value that was returned from the event handler.<br />
The event is not deleted when the event has been sent. The normal approach is to create the event on the stack, for example:<br />
QMouseEvent event(QEvent::MouseButtonPress, pos, 0, 0, 0);<br />
QApplication::sendEvent(mainWindow, &amp;event);</p>
</blockquote>
<p dir="auto">@AnneRanch said in Passing messages between objects - alternative to "connect" ?:</p>
<blockquote>
<p dir="auto">Is there a reasonably straight forward way to enable "parent" to access the child form ?</p>
</blockquote>
<p dir="auto">Yes, include the ui_childName.h and in child class add a get method:<br />
UI::ChildName* childUi() { return ui; }<br />
some will say it's bad practice bla bla, it's up to you to decide :)</p>
<p dir="auto">The other way is to retreive each object by name:<br />
child-&gt;findChild&lt;SomeClass*&gt;("objectName")</p>
<p dir="auto">Of course, the "normal/right way" is to define getters for all the objects you need,<br />
but it is borring I know ;)</p>
]]></description><link>https://forum.qt.io/post/743821</link><guid isPermaLink="true">https://forum.qt.io/post/743821</guid><dc:creator><![CDATA[mpergand]]></dc:creator><pubDate>Fri, 13 Jan 2023 21:12:41 GMT</pubDate></item></channel></rss>