<?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[QMessageBox &quot;ok&quot; button closes whole program.]]></title><description><![CDATA[<p dir="auto">Hey guys i'm new to qt and I'm trying to display an error by  opening up a new QMessage box when when a button is clicked and an input was wrong.</p>
<p dir="auto">Here's by code</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/void">@<bdi>void</bdi></a> errorFunction()<br />
{<br />
if(/<em>some code</em>/)<br />
{</p>
<pre><code>}
</code></pre>
<p dir="auto">else<br />
{<br />
QMessageBox *msgBox== new QMessageBox();</p>
<p dir="auto">msgBox-&gt;setText("You didn't enter a number 1-5! Try again");</p>
<p dir="auto">msgBox-&gt;exec();<br />
}</p>
<p dir="auto">}@</p>
]]></description><link>https://forum.qt.io/topic/48963/qmessagebox-ok-button-closes-whole-program</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 11:26:55 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/48963.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 07 Dec 2014 22:41:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QMessageBox &quot;ok&quot; button closes whole program. on Tue, 09 Dec 2014 04:26:18 GMT]]></title><description><![CDATA[<p dir="auto">And should that not be an assignment operator(=) instead of an equivalense test (==) operator</p>
]]></description><link>https://forum.qt.io/post/253632</link><guid isPermaLink="true">https://forum.qt.io/post/253632</guid><dc:creator><![CDATA[DBoosalis]]></dc:creator><pubDate>Tue, 09 Dec 2014 04:26:18 GMT</pubDate></item><item><title><![CDATA[Reply to QMessageBox &quot;ok&quot; button closes whole program. on Mon, 08 Dec 2014 23:27:00 GMT]]></title><description><![CDATA[<p dir="auto">What should be executed after that slot is called ?</p>
]]></description><link>https://forum.qt.io/post/253622</link><guid isPermaLink="true">https://forum.qt.io/post/253622</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Mon, 08 Dec 2014 23:27:00 GMT</pubDate></item><item><title><![CDATA[Reply to QMessageBox &quot;ok&quot; button closes whole program. on Sun, 07 Dec 2014 23:13:24 GMT]]></title><description><![CDATA[<p dir="auto">Hi, errorFunction is called when I click a button. So I connected the button to this function like this:</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/connect">@<bdi>connect</bdi></a>(rateButton,SIGNAL(clicked()),this,SLOT(errorFunction()));<br />
@</p>
<p dir="auto">[quote author="SGaist" date="1417993095"]Hi,</p>
<p dir="auto">From where is errorFunction called ?</p>
<p dir="auto">Note that you have a memory leak here. Either delete msgBox after the call to exec or allocate it on the stack.[/quote]</p>
]]></description><link>https://forum.qt.io/post/253533</link><guid isPermaLink="true">https://forum.qt.io/post/253533</guid><dc:creator><![CDATA[hoomz]]></dc:creator><pubDate>Sun, 07 Dec 2014 23:13:24 GMT</pubDate></item><item><title><![CDATA[Reply to QMessageBox &quot;ok&quot; button closes whole program. on Sun, 07 Dec 2014 22:58:15 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">From where is errorFunction called ?</p>
<p dir="auto">Note that you have a memory leak here. Either delete msgBox after the call to exec or allocate it on the stack.</p>
]]></description><link>https://forum.qt.io/post/253531</link><guid isPermaLink="true">https://forum.qt.io/post/253531</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Sun, 07 Dec 2014 22:58:15 GMT</pubDate></item></channel></rss>