<?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[Dialogs no longer closing when another is active.]]></title><description><![CDATA[<p dir="auto">Our project is upgrading from Qt5 to Qt6.  There are multiple places where our applications will open a dialog, then another dialog will open over it, then close the first (using accept() or reject() ) while the second dialog is open.  This no longer seems to be working, and the first dialog stays open.  I've been able to change some ordering, so the first dialog closes before the second opens, or the closing of the second dialog triggers the first.  However, I'm now running into cases where there are more dialogs, and it's turning into a sequencing mess.  Is there some configuration that allows or dissallows accept() and reject() to close dialogs if they don't have focus?</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.qt.io/topic/139149/dialogs-no-longer-closing-when-another-is-active</link><generator>RSS for Node</generator><lastBuildDate>Tue, 03 Nov 2026 02:11:20 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/139149.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Sep 2022 16:02:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dialogs no longer closing when another is active. on Thu, 08 Sep 2022 07:13:36 GMT]]></title><description><![CDATA[<p dir="auto">Well, here is my guess: First of all, I assume that your dialogs are all modal, and secondly that you use <code>dialog.exec()</code> to run them (which creates the nested event loops that <a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> mentioned). If <code>FunctionThatOpensDialog2</code> gets executed first and uses <code>exec()</code> it will not return before the new dialog closes. If Qt uses a direct call to <code>FunctionThatOpensDialog2</code> instead of placing it into the event loop, I assume that the <code>clicked()</code> signal will not call <code>reject()</code> before <code>FunctionThatOpensDialog2</code> returns.</p>
<p dir="auto">If you need control over the order of execution (the order of the connects is not bullet proof) you have to follow the suggestion of <a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a>  and use a dedicated slot (could be a lambda that calls the two functions in order).</p>
<p dir="auto">Another thing you can try (derived from my guess above) is to add the parameter <code>Qt::QueuedConnection</code> to the connect calls. If you are lucky the <code>exec()</code> from <code>FunctionThatOpensDialog2</code> will handle the queued <code>reject()</code> as well. (I am not 100% sure because of the modality of the second dialog.)</p>
]]></description><link>https://forum.qt.io/post/727868</link><guid isPermaLink="true">https://forum.qt.io/post/727868</guid><dc:creator><![CDATA[SimonSchroeder]]></dc:creator><pubDate>Thu, 08 Sep 2022 07:13:36 GMT</pubDate></item><item><title><![CDATA[Reply to Dialogs no longer closing when another is active. on Wed, 07 Sep 2022 19:03:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nate-m">@<bdi>Nate-M</bdi></a> said in <a href="/post/727796">Dialogs no longer closing when another is active.</a>:</p>
<blockquote>
<p dir="auto">There are multiple places where our applications will open a dialog, then another dialog will open over it, then close the first (using accept() or reject() ) while the second dialog is open.</p>
</blockquote>
<p dir="auto">Awfull design :(<br />
If you have multi screens/dialogs to present one after the other,<br />
use <a href="https://doc.qt.io/qt-6/qtwidgets-dialogs-classwizard-example.html" target="_blank" rel="noopener noreferrer nofollow ugc">QWizard</a></p>
]]></description><link>https://forum.qt.io/post/727831</link><guid isPermaLink="true">https://forum.qt.io/post/727831</guid><dc:creator><![CDATA[mpergand]]></dc:creator><pubDate>Wed, 07 Sep 2022 19:03:58 GMT</pubDate></item><item><title><![CDATA[Reply to Dialogs no longer closing when another is active. on Wed, 07 Sep 2022 18:41:06 GMT]]></title><description><![CDATA[<p dir="auto">I don't think so. However having event loops within event loops might have side effects and you could be experiencing that.</p>
<p dir="auto">Hence my suggestion of keeping that kind of processing within dedicated slots.</p>
]]></description><link>https://forum.qt.io/post/727825</link><guid isPermaLink="true">https://forum.qt.io/post/727825</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 07 Sep 2022 18:41:06 GMT</pubDate></item><item><title><![CDATA[Reply to Dialogs no longer closing when another is active. on Wed, 07 Sep 2022 18:32:26 GMT]]></title><description><![CDATA[<p dir="auto">Unfortunately, other instances that need fixing aren't as straightforward.  Was there any changes between Qt5 and Qt6 that change how modal dialogs behave?  For example, not allowing dialogs below to receiving signals, or not allowing them to accept/reject?</p>
]]></description><link>https://forum.qt.io/post/727824</link><guid isPermaLink="true">https://forum.qt.io/post/727824</guid><dc:creator><![CDATA[Nate M]]></dc:creator><pubDate>Wed, 07 Sep 2022 18:32:26 GMT</pubDate></item><item><title><![CDATA[Reply to Dialogs no longer closing when another is active. on Wed, 07 Sep 2022 17:39:39 GMT]]></title><description><![CDATA[<p dir="auto">You should rather have one slot that does all the work. It would be cleaner to maintain as well.</p>
]]></description><link>https://forum.qt.io/post/727809</link><guid isPermaLink="true">https://forum.qt.io/post/727809</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 07 Sep 2022 17:39:39 GMT</pubDate></item><item><title><![CDATA[Reply to Dialogs no longer closing when another is active. on Wed, 07 Sep 2022 16:31:17 GMT]]></title><description><![CDATA[<p dir="auto">Here's how I fixed one of the issues.  Here is the code that closes Dialog1 in Qt5, but in Qt6 leaves Dialog1 still open:</p>
<pre><code>connect( ui.ui_buttonNew, &amp;QPushButton::clicked, handler, &amp;Handler::FunctionThatOpensDialog2 );
connect( ui.ui_buttonNew, &amp;QPushButton::clicked, this, &amp;Dialog1::reject );
</code></pre>
<p dir="auto">To fix it, I just reversed the order, so that Dialog1 closes before the function that opens Dialog2:</p>
<pre><code>connect( ui.ui_buttonNew, &amp;QPushButton::clicked, this, &amp;Dialog1::reject );
connect( ui.ui_buttonNew, &amp;QPushButton::clicked, handler, &amp;Handler::FunctionThatOpensDialog2 );
</code></pre>
]]></description><link>https://forum.qt.io/post/727802</link><guid isPermaLink="true">https://forum.qt.io/post/727802</guid><dc:creator><![CDATA[Nate M]]></dc:creator><pubDate>Wed, 07 Sep 2022 16:31:17 GMT</pubDate></item><item><title><![CDATA[Reply to Dialogs no longer closing when another is active. on Wed, 07 Sep 2022 16:09:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nate-m">@<bdi>Nate-M</bdi></a> said in <a href="/post/727796">Dialogs no longer closing when another is active.</a>:</p>
<blockquote>
<p dir="auto">Is there some configuration that allows or dissallows accept() and reject() to close dialogs if they don't have focus?</p>
</blockquote>
<p dir="auto">For sure not.<br />
You might want to supply some minimal example showing the changed behaviour.</p>
]]></description><link>https://forum.qt.io/post/727799</link><guid isPermaLink="true">https://forum.qt.io/post/727799</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 07 Sep 2022 16:09:21 GMT</pubDate></item></channel></rss>