<?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[What are the differences between accept and setResult]]></title><description><![CDATA[<p dir="auto">Hello everyone,<br />
Could somebody give me some advice?</p>
<p dir="auto">I create a sub dialog. I want to set the result to Accepted when I click some button. So I use code "setResult(Accepted)" in the slot function. But it doesn't work. The result is still  Rejected. But if I use code "accept()" in the slot function, it works.</p>
<p dir="auto">So I wonder what are the differences between accept() and setResult(Accepted)?</p>
<p dir="auto">Thanks in advance.</p>
]]></description><link>https://forum.qt.io/topic/101936/what-are-the-differences-between-accept-and-setresult</link><generator>RSS for Node</generator><lastBuildDate>Fri, 14 Aug 2026 12:56:09 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/101936.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 20 Apr 2019 02:44:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to What are the differences between accept and setResult on Tue, 07 May 2019 01:35:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a><br />
I use accept() or reject(). But the dialog doesn't close automatically. I have to use close() to close it.</p>
]]></description><link>https://forum.qt.io/post/527385</link><guid isPermaLink="true">https://forum.qt.io/post/527385</guid><dc:creator><![CDATA[Qingshui Kong]]></dc:creator><pubDate>Tue, 07 May 2019 01:35:42 GMT</pubDate></item><item><title><![CDATA[Reply to What are the differences between accept and setResult on Mon, 22 Apr 2019 04:56:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a><br />
OK. Thank you very much.</p>
]]></description><link>https://forum.qt.io/post/524253</link><guid isPermaLink="true">https://forum.qt.io/post/524253</guid><dc:creator><![CDATA[Qingshui Kong]]></dc:creator><pubDate>Mon, 22 Apr 2019 04:56:12 GMT</pubDate></item><item><title><![CDATA[Reply to What are the differences between accept and setResult on Sat, 20 Apr 2019 09:19:49 GMT]]></title><description><![CDATA[<p dir="auto">Now I understand what you want. This is due to the fact that QDialog::closeEvent() sets the result code depending on the visibility of the dialog since this event can also be triggered from the outside. I would recommend to use accept()/reject()/done() as this is the recommended way stated in the documentation.</p>
]]></description><link>https://forum.qt.io/post/524068</link><guid isPermaLink="true">https://forum.qt.io/post/524068</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Sat, 20 Apr 2019 09:19:49 GMT</pubDate></item><item><title><![CDATA[Reply to What are the differences between accept and setResult on Sat, 20 Apr 2019 08:21:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a><br />
Yes, it should be a modal dialog.<br />
Here are some codes.<br />
At the begining, I use setResult.<br />
void VXFaultDialog::onBtnCloseClicked()<br />
{<br />
setResult(Accepted);<br />
close();<br />
}<br />
But it doesn't work. So I choose accept();<br />
void VXFaultDialog::onBtnCloseClicked()<br />
{<br />
accept();<br />
close();<br />
}<br />
Then it works.</p>
]]></description><link>https://forum.qt.io/post/524064</link><guid isPermaLink="true">https://forum.qt.io/post/524064</guid><dc:creator><![CDATA[Qingshui Kong]]></dc:creator><pubDate>Sat, 20 Apr 2019 08:21:32 GMT</pubDate></item><item><title><![CDATA[Reply to What are the differences between accept and setResult on Sat, 20 Apr 2019 08:02:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qingshui-kong">@<bdi>Qingshui-Kong</bdi></a> said in <a href="/post/524062">What are the differences between accept and setResult</a>:</p>
<blockquote>
<p dir="auto">I add close() after accept() and setResult(Accepted).</p>
</blockquote>
<p dir="auto">Please show us some code - there is no need to call close() after accept(), only needed when you want to close the window when you only call setResult().<br />
Do you show a modal dialog? If so how to you exit the dialog when calling setResult()?</p>
]]></description><link>https://forum.qt.io/post/524063</link><guid isPermaLink="true">https://forum.qt.io/post/524063</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Sat, 20 Apr 2019 08:02:58 GMT</pubDate></item><item><title><![CDATA[Reply to What are the differences between accept and setResult on Sat, 20 Apr 2019 07:59:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a><br />
Thank you very much.<br />
I see. I add close() after accept() and setResult(Accepted).<br />
But the result code is not what I set by using setResult(Accepted). Do you mean I should overwrite setResult() or some other functions?<br />
Thank you again.</p>
]]></description><link>https://forum.qt.io/post/524062</link><guid isPermaLink="true">https://forum.qt.io/post/524062</guid><dc:creator><![CDATA[Qingshui Kong]]></dc:creator><pubDate>Sat, 20 Apr 2019 07:59:59 GMT</pubDate></item><item><title><![CDATA[Reply to What are the differences between accept and setResult on Sat, 20 Apr 2019 06:38:08 GMT]]></title><description><![CDATA[<p dir="auto">accept() sets the result code to Accepted and closes the dialog, setResult() only sets the result code. If your result code is not what you expect you maybe overwrite it somewhere in between.</p>
]]></description><link>https://forum.qt.io/post/524055</link><guid isPermaLink="true">https://forum.qt.io/post/524055</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Sat, 20 Apr 2019 06:38:08 GMT</pubDate></item></channel></rss>