<?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[QFileDialog close my application]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I add to my program a QFileDialog window. When I close the file dialog window, the function keep executing the following command but at the end of the function the main window is closed and after the FileDialog.</p>
<p dir="auto">Here is my program:</p>
<pre><code>class Controller(QtWidgets.QWidget):
    view: View
    model: Model

    def __init__(self, model: Model, view: View):
        super(Controller, self).__init__()


    def open_datalog_folder(self, txt):
        print(txt)
        file_dialog = QFileDialog()
        try:
            directory = file_dialog.getOpenFileName(None, "Select directory")
            # file_dialog.blockSignals(True)
            print ('here')
        except:
            print("fzz")
            pass
</code></pre>
<p dir="auto">When I execute the program, I get the "Here" flag and the the program close. I try to block the signal from my file dialog quit event to avoid to send it to the lain window but it does work.</p>
]]></description><link>https://forum.qt.io/topic/145709/qfiledialog-close-my-application</link><generator>RSS for Node</generator><lastBuildDate>Wed, 28 Oct 2026 19:54:22 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/145709.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 12 Jun 2023 06:51:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QFileDialog close my application on Mon, 12 Jun 2023 11:47:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a></p>
<p dir="auto">It seems to work. Thank you.</p>
]]></description><link>https://forum.qt.io/post/761199</link><guid isPermaLink="true">https://forum.qt.io/post/761199</guid><dc:creator><![CDATA[Xav12358]]></dc:creator><pubDate>Mon, 12 Jun 2023 11:47:29 GMT</pubDate></item><item><title><![CDATA[Reply to QFileDialog close my application on Mon, 12 Jun 2023 08:07:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/xav12358">@<bdi>Xav12358</bdi></a><br />
Well if you have the main window already <em>open</em> as you just wrote then the file dialog close will <em>not</em> be the last visible window to close so this won't apply?  But I was talking about <a href="https://doc.qt.io/qt-6/qguiapplication.html#quitOnLastWindowClosed-prop" target="_blank" rel="noopener noreferrer nofollow ugc">QGuiApplication::setQuitOnLastWindowClosed(bool quit)</a>, which one can set to false.</p>
]]></description><link>https://forum.qt.io/post/761182</link><guid isPermaLink="true">https://forum.qt.io/post/761182</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Mon, 12 Jun 2023 08:07:41 GMT</pubDate></item><item><title><![CDATA[Reply to QFileDialog close my application on Mon, 12 Jun 2023 08:02:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a></p>
<p dir="auto">Indeed I have the mainwindows already open. How could I change the option you mention?</p>
]]></description><link>https://forum.qt.io/post/761181</link><guid isPermaLink="true">https://forum.qt.io/post/761181</guid><dc:creator><![CDATA[Xav12358]]></dc:creator><pubDate>Mon, 12 Jun 2023 08:02:45 GMT</pubDate></item><item><title><![CDATA[Reply to QFileDialog close my application on Mon, 12 Jun 2023 07:57:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/xav12358">@<bdi>Xav12358</bdi></a><br />
At the time you show the File Dialog do you have any <em>other</em> window/widget currently open/visible in your application?  By default Qt widget applications are set to close and exit when the last visible window is closed, that might be your situation?</p>
]]></description><link>https://forum.qt.io/post/761180</link><guid isPermaLink="true">https://forum.qt.io/post/761180</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Mon, 12 Jun 2023 07:57:17 GMT</pubDate></item><item><title><![CDATA[Reply to QFileDialog close my application on Mon, 12 Jun 2023 07:17:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> said in <a href="/post/761168">QFileDialog close my application</a>:</p>
<blockquote>
<p dir="auto">QFileDialog</p>
</blockquote>
<p dir="auto">Than you for the tips. Indeed it is a static method, but I still have the same trouble.</p>
]]></description><link>https://forum.qt.io/post/761169</link><guid isPermaLink="true">https://forum.qt.io/post/761169</guid><dc:creator><![CDATA[Xav12358]]></dc:creator><pubDate>Mon, 12 Jun 2023 07:17:41 GMT</pubDate></item><item><title><![CDATA[Reply to QFileDialog close my application on Mon, 12 Jun 2023 07:12:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/xav12358">@<bdi>Xav12358</bdi></a> said in <a href="/post/761166">QFileDialog close my application</a>:</p>
<blockquote>
<p dir="auto">getOpenFileName</p>
</blockquote>
<p dir="auto">This is a static method: there is no need to create a QFileDialog instance to call it.</p>
]]></description><link>https://forum.qt.io/post/761168</link><guid isPermaLink="true">https://forum.qt.io/post/761168</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Mon, 12 Jun 2023 07:12:21 GMT</pubDate></item></channel></rss>