<?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::getOpenFileName() returning incorrect file]]></title><description><![CDATA[<p dir="auto">Hi.</p>
<p dir="auto">I've got an issue with a program using QFileDialog::getOpenFileName() to get a file selection from the user. I suspect a Qt bug, but I thought I'd run it through the forum before submitting a report. The problem is simply that the call sometimes seems to return a different file from the one actually selected. This does not always happen, but I can reproduce the behaviour as follows:</p>
<h1>Create a new directory and copy a few files to it.</h1>
<h1>Trigger QFileDialog::getOpenFileName() in the application...</h1>
<h1>In the file selector, go to the directory created above, then select one of the files - and leave the dialog open for now.</h1>
<h1>Add another file to the directory via some other application, a text terminal or whatever.</h1>
<h1>Wait for the new file to appear in the file selector. (This should happen automatically after a brief delay.)</h1>
<h1>Press Open.</h1>
<p dir="auto">Like I said, the file name I then get does not match the selection I made. This also happens with the simple test program included below.</p>
<p dir="auto">Has anyone else seen anything like this?</p>
<p dir="auto">I'm using Qt 4.8.5 under CentOS Linux version 6.</p>
<p dir="auto">@#include &lt;QApplication&gt;<br />
#include &lt;QFileDialog&gt;</p>
<p dir="auto">int main(int argc, char **argv)<br />
{<br />
QApplication app(argc, argv);</p>
<pre><code>QString fileName=
  QFileDialog::getOpenFileName(NULL, "Open A file", qgetenv("HOME"),
   "All files (*)");
qDebug("%s...", qPrintable(fileName));
</code></pre>
<p dir="auto">}<br />
@</p>
]]></description><link>https://forum.qt.io/topic/35294/qfiledialog-getopenfilename-returning-incorrect-file</link><generator>RSS for Node</generator><lastBuildDate>Tue, 10 Nov 2026 02:26:36 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/35294.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 10 Dec 2013 08:54:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QFileDialog::getOpenFileName() returning incorrect file on Fri, 13 Dec 2013 09:14:07 GMT]]></title><description><![CDATA[<p dir="auto">I'm now quite convinced that this is an issue with the Gtk file selector - which is picked up Qt when the GUI style is "Desktop" (in my setup.) So I think I'll report the issue elsewhere. Or should I still create a Qt bug "for the record"?</p>
]]></description><link>https://forum.qt.io/post/207272</link><guid isPermaLink="true">https://forum.qt.io/post/207272</guid><dc:creator><![CDATA[toralf]]></dc:creator><pubDate>Fri, 13 Dec 2013 09:14:07 GMT</pubDate></item><item><title><![CDATA[Reply to QFileDialog::getOpenFileName() returning incorrect file on Tue, 10 Dec 2013 09:38:39 GMT]]></title><description><![CDATA[<p dir="auto">One reason or not doing that without a "reality check" would be that this is not necessarily a <em>Qt</em> bug, since a "system" file selector may be used.</p>
]]></description><link>https://forum.qt.io/post/206888</link><guid isPermaLink="true">https://forum.qt.io/post/206888</guid><dc:creator><![CDATA[toralf]]></dc:creator><pubDate>Tue, 10 Dec 2013 09:38:39 GMT</pubDate></item><item><title><![CDATA[Reply to QFileDialog::getOpenFileName() returning incorrect file on Tue, 10 Dec 2013 09:28:47 GMT]]></title><description><![CDATA[<p dir="auto">since this is a very straightforward example it's fine when you create a bugreport for it ;)<br />
Just paste the description from here and OS into the bugreport.</p>
]]></description><link>https://forum.qt.io/post/206887</link><guid isPermaLink="true">https://forum.qt.io/post/206887</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Tue, 10 Dec 2013 09:28:47 GMT</pubDate></item></channel></rss>