<?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[gotnewmessage() signal does not emit after sendmessage() signal]]></title><description><![CDATA[[[topic:post-is-deleted]]]]></description><link>https://forum.qt.io/topic/122706/gotnewmessage-signal-does-not-emit-after-sendmessage-signal</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Apr 2026 23:17:15 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/122706.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 14 Jan 2021 15:12:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to gotnewmessage() signal does not emit after sendmessage() signal on Thu, 14 Jan 2021 19:16:11 GMT]]></title><description><![CDATA[<p dir="auto">Because there's no reason for that to happen. You just connected a signal to another signal.</p>
<p dir="auto">Excuse me for being blunt but: your current code is a mess. Your architecture is wrong on several levels. You seem to want some kind of threaded server inside a GUI while also making it its own client but without any connection.</p>
<p dir="auto">As I already suggested, if you really want to use threads (and you really don't at this stage), read the threaded fortune server example.</p>
<p dir="auto">Keep things clearly separated. Have one server component, then build your GUI to use that component. Look for aggregation VS inheritance.</p>
]]></description><link>https://forum.qt.io/post/637983</link><guid isPermaLink="true">https://forum.qt.io/post/637983</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 14 Jan 2021 19:16:11 GMT</pubDate></item><item><title><![CDATA[Reply to gotnewmessage() signal does not emit after sendmessage() signal on Thu, 14 Jan 2021 18:59:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> ohh I just figured out once sendmessage() signal is emitted from mainwindow class then the readyread() function is not executed in fthread class. But why is that so?</p>
]]></description><link>https://forum.qt.io/post/637980</link><guid isPermaLink="true">https://forum.qt.io/post/637980</guid><dc:creator><![CDATA[fari35]]></dc:creator><pubDate>Thu, 14 Jan 2021 18:59:29 GMT</pubDate></item><item><title><![CDATA[Reply to gotnewmessage() signal does not emit after sendmessage() signal on Thu, 14 Jan 2021 18:29:27 GMT]]></title><description><![CDATA[<p dir="auto">That will be part of the problem at some point because it makes your code messy.</p>
<p dir="auto">In any case, you have an issue with the socket creation as it's not done in the correct thread.</p>
<p dir="auto">You should really clean your implementation. It will make your code easier to manage and debug.</p>
]]></description><link>https://forum.qt.io/post/637975</link><guid isPermaLink="true">https://forum.qt.io/post/637975</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 14 Jan 2021 18:29:27 GMT</pubDate></item><item><title><![CDATA[Reply to gotnewmessage() signal does not emit after sendmessage() signal on Thu, 14 Jan 2021 18:24:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> Actually that's not the problem. The problem is that it is emitting gotnewmessage() signal until I don't click send button in mainwindow class to  emit sendmessage() signal, but  once sendmessage() signal is emmitted gotnewmessage() signal doesn't emit</p>
]]></description><link>https://forum.qt.io/post/637973</link><guid isPermaLink="true">https://forum.qt.io/post/637973</guid><dc:creator><![CDATA[fari35]]></dc:creator><pubDate>Thu, 14 Jan 2021 18:24:54 GMT</pubDate></item><item><title><![CDATA[Reply to gotnewmessage() signal does not emit after sendmessage() signal on Thu, 14 Jan 2021 18:19:18 GMT]]></title><description><![CDATA[<p dir="auto">This is not how it works. Please check the threaded fortune server example if you really want to use threads.</p>
<p dir="auto">In any case, the way you use multiple inheritance is wrong.</p>
]]></description><link>https://forum.qt.io/post/637971</link><guid isPermaLink="true">https://forum.qt.io/post/637971</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 14 Jan 2021 18:19:18 GMT</pubDate></item><item><title><![CDATA[Reply to gotnewmessage() signal does not emit after sendmessage() signal on Thu, 14 Jan 2021 18:10:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> because I want to use the same object of fthread class in both the server and mainwindow class</p>
]]></description><link>https://forum.qt.io/post/637970</link><guid isPermaLink="true">https://forum.qt.io/post/637970</guid><dc:creator><![CDATA[fari35]]></dc:creator><pubDate>Thu, 14 Jan 2021 18:10:32 GMT</pubDate></item><item><title><![CDATA[Reply to gotnewmessage() signal does not emit after sendmessage() signal on Thu, 14 Jan 2021 17:58:35 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fari35">@<bdi>fari35</bdi></a> said in <a href="/post/637938">gotnewmessage() signal does not emit after sendmessage() signal</a>:</p>
<blockquote>
<p dir="auto">class fserver : public QTcpServer,public threadobj</p>
</blockquote>
<p dir="auto">Why the double heritage ?</p>
]]></description><link>https://forum.qt.io/post/637967</link><guid isPermaLink="true">https://forum.qt.io/post/637967</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 14 Jan 2021 17:58:35 GMT</pubDate></item><item><title><![CDATA[Reply to gotnewmessage() signal does not emit after sendmessage() signal on Thu, 14 Jan 2021 17:42:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> ok I have corrected that. Can you please tell me why gotnewmessage()  is not working after sendmessage() signal is emmited from windows class?</p>
]]></description><link>https://forum.qt.io/post/637964</link><guid isPermaLink="true">https://forum.qt.io/post/637964</guid><dc:creator><![CDATA[fari35]]></dc:creator><pubDate>Thu, 14 Jan 2021 17:42:55 GMT</pubDate></item><item><title><![CDATA[Reply to gotnewmessage() signal does not emit after sendmessage() signal on Thu, 14 Jan 2021 17:36:48 GMT]]></title><description><![CDATA[<p dir="auto">I did not look what the code really does but tcpSocket is created in the wrong thread. You must create it inside run() so it's created in the new thread.</p>
]]></description><link>https://forum.qt.io/post/637963</link><guid isPermaLink="true">https://forum.qt.io/post/637963</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Thu, 14 Jan 2021 17:36:48 GMT</pubDate></item><item><title><![CDATA[Reply to gotnewmessage() signal does not emit after sendmessage() signal on Thu, 14 Jan 2021 17:09:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aha_1980">@<bdi>aha_1980</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/kshegunov">@<bdi>kshegunov</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> Do you have anyidea about this?</p>
]]></description><link>https://forum.qt.io/post/637960</link><guid isPermaLink="true">https://forum.qt.io/post/637960</guid><dc:creator><![CDATA[fari35]]></dc:creator><pubDate>Thu, 14 Jan 2021 17:09:42 GMT</pubDate></item><item><title><![CDATA[Reply to gotnewmessage() signal does not emit after sendmessage() signal on Thu, 14 Jan 2021 17:01:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fari35">@<bdi>fari35</bdi></a><br />
Too much for me, and I've done my bit.  You should cut down the code to make it minimal and put <code>qDebug()</code> statements in to see what is/is not getting called.</p>
<p dir="auto">As a separate matter, get rid of old-style <code>SIGNAL</code>/<code>SLOT()</code> macros and always use new style.  You presently have a mixture.</p>
]]></description><link>https://forum.qt.io/post/637957</link><guid isPermaLink="true">https://forum.qt.io/post/637957</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Thu, 14 Jan 2021 17:01:00 GMT</pubDate></item><item><title><![CDATA[Reply to gotnewmessage() signal does not emit after sendmessage() signal on Thu, 14 Jan 2021 16:53:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a>  I have now attached my whole code in the question. Can you please tell me what is wrong here?</p>
]]></description><link>https://forum.qt.io/post/637956</link><guid isPermaLink="true">https://forum.qt.io/post/637956</guid><dc:creator><![CDATA[fari35]]></dc:creator><pubDate>Thu, 14 Jan 2021 16:53:54 GMT</pubDate></item><item><title><![CDATA[Reply to gotnewmessage() signal does not emit after sendmessage() signal on Thu, 14 Jan 2021 15:24:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fari35">@<bdi>fari35</bdi></a><br />
You're going to have show code for anyone to comment.  In itself the fact that you changed how <code>sendmessage()</code> is sent/connected cannot affect something not being able to emit its own message.</p>
<p dir="auto">Try to show just the relevant bare-bones.  We <em>probably</em> don't need to see the send message side, but do we do need to see (a) confirmation that the thread's slot is called from the send message and (b) how the thread does its <code>emit gotnewmessage()</code> and (c) how that emitted signal is connected to the slot which should act on it.  Put in <code>qDebug()</code>s to prove what's going on!</p>
]]></description><link>https://forum.qt.io/post/637941</link><guid isPermaLink="true">https://forum.qt.io/post/637941</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Thu, 14 Jan 2021 15:24:09 GMT</pubDate></item></channel></rss>