<?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[Disable &quot;Open&quot; button when no file is selected in QFileDialog]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">We are making an internal configuration tool using PyQt5 5.15.4.<br />
Development is done on macOS Catalina 10.15.7<br />
The final version will run on both OSX and Windows 10</p>
<p dir="auto">On Windows 10, when you open a QFileDialog, the "Open" button is enabled even when no file is selected.<br />
<a href="https://imgur.com/a/XHKueYi" target="_blank" rel="noopener noreferrer nofollow ugc">Here is an image to illustrate the issue.</a></p>
<p dir="auto">Is there a way to change this behaviour?<br />
For example, on MacOS, the button is disabled as long as no file is selected.<br />
Would it be possible to have the same behaviour on Windows 10?</p>
<p dir="auto">Thanks,<br />
FVez</p>
]]></description><link>https://forum.qt.io/topic/141499/disable-open-button-when-no-file-is-selected-in-qfiledialog</link><generator>RSS for Node</generator><lastBuildDate>Sat, 27 Jun 2026 15:18:55 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/141499.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 14 Dec 2022 19:06:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Disable &quot;Open&quot; button when no file is selected in QFileDialog on Fri, 16 Dec 2022 21:38:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> is correct, the default is to use the native file dialogs which means follow the platform style for interaction.</p>
]]></description><link>https://forum.qt.io/post/740615</link><guid isPermaLink="true">https://forum.qt.io/post/740615</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 16 Dec 2022 21:38:53 GMT</pubDate></item><item><title><![CDATA[Reply to Disable &quot;Open&quot; button when no file is selected in QFileDialog on Fri, 16 Dec 2022 15:53:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fvez_demtroys">@<bdi>fvez_demtroys</bdi></a> said in <a href="/post/740583">Disable "Open" button when no file is selected in QFileDialog</a>:</p>
<blockquote>
<p dir="auto">I was wondering if QFileDialog had a way of disabling the open button as long as no file is selected.</p>
</blockquote>
<p dir="auto">I'm not sure, but I don't think so.  You are using the <em>native</em> Windows dialog here, not the Qt-rolled alternative one.  That means it looks and functions under the windowing system's control, I believe.</p>
]]></description><link>https://forum.qt.io/post/740584</link><guid isPermaLink="true">https://forum.qt.io/post/740584</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Fri, 16 Dec 2022 15:53:26 GMT</pubDate></item><item><title><![CDATA[Reply to Disable &quot;Open&quot; button when no file is selected in QFileDialog on Fri, 16 Dec 2022 15:49:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> I invoke the dialog with</p>
<pre><code>QFileDialog.getOpenFileName(caption='Open .txt', filter="Text Files (*.txt)")
</code></pre>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> Yes I did see that this seemed like standard behaviour on Windows.<br />
I was wondering if QFileDialog had a way of disabling the open button as long as no file is selected.<br />
I don't necessarily want to change it manually, seems like a lot of work for very little gain.<br />
I added safety checks on the string obtained by getOpenFileName, this way if no file is selected it shouldn't cause issues.</p>
<p dir="auto">Thanks!<br />
FVez</p>
]]></description><link>https://forum.qt.io/post/740583</link><guid isPermaLink="true">https://forum.qt.io/post/740583</guid><dc:creator><![CDATA[fvez_demtroys]]></dc:creator><pubDate>Fri, 16 Dec 2022 15:49:16 GMT</pubDate></item><item><title><![CDATA[Reply to Disable &quot;Open&quot; button when no file is selected in QFileDialog on Wed, 14 Dec 2022 20:03:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fvez_demtroys">@<bdi>fvez_demtroys</bdi></a><br />
Are you aware that this is actually the normal behaviour of this Windows "Open" dialog, e.g. cf. from <strong>Notepad</strong>?  I had never noticed and agree I don't know why, but given it's the standard Windows behaviour do you really want to bother to try changing it?</p>
]]></description><link>https://forum.qt.io/post/740317</link><guid isPermaLink="true">https://forum.qt.io/post/740317</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 14 Dec 2022 20:03:06 GMT</pubDate></item><item><title><![CDATA[Reply to Disable &quot;Open&quot; button when no file is selected in QFileDialog on Wed, 14 Dec 2022 19:34:20 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">How are you invoking that dialog ?</p>
]]></description><link>https://forum.qt.io/post/740312</link><guid isPermaLink="true">https://forum.qt.io/post/740312</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 14 Dec 2022 19:34:20 GMT</pubDate></item></channel></rss>