<?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 File&#x2F;Directory field gets truncated]]></title><description><![CDATA[<p dir="auto">I happen to have a weird behavior of QFileDialog in my application. It is not consistent across different stations and debug/optimized versions, but it happens still.</p>
<p dir="auto">I have a QfileDialog that opens with QFileDialog::ShowDirsOnly option, the 'File name' label at the bottom reads 'Directory:' and displays the current directory name right next to it.<br />
I then start to type into that filed: "C:" and the file dialog starts to complete the path.<br />
When doing so, I get a drop-down menu with all directories under "C:".<br />
Then, I go ahead and type 't', which yields "C:\t", for which the menu below shows: "temp" and "tmp".<br />
I then go down with the down arrow and stop at "temp".<br />
As soon as I select 'temp', the directory field reads: "emp", instead of "C:\temp".</p>
<p dir="auto">Does any one have any idea why this is happening and how can I resolve, or work-around it?<br />
The system is Windows 7 and Qt version is 4.5.1.</p>
<p dir="auto">Any comment will be appreciated.<br />
Thanks.</p>
]]></description><link>https://forum.qt.io/topic/78565/qfiledialog-file-directory-field-gets-truncated</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Apr 2026 20:33:28 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/78565.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 24 Apr 2017 08:52:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QFileDialog File&#x2F;Directory field gets truncated on Thu, 27 Apr 2017 10:57:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ni.sumi">@<bdi>Ni.Sumi</bdi></a> said in <a href="/post/389669">QFileDialog File/Directory field gets truncated</a>:</p>
<blockquote>
<p dir="auto">are</p>
</blockquote>
<p dir="auto">The code creating that dialog is:</p>
<p dir="auto">QFileDialog *fd = new QFileDialog();<br />
fd-&gt;setNameFilters(filtersList); // QStringList filterList...<br />
fd-&gt;setDirectory(tmp); // QString tmp...<br />
fd-&gt;setWindowTitle(QString("Open Directory"));<br />
fd-&gt;setFileMode(QFileDialog::Directory);<br />
fd-&gt;setOption(QFileDialog::ShowDirsOnly, true);<br />
fd-&gt;setAcceptMode(QFileDialog::AcceptOpen);<br />
fd-&gt;exec();</p>
<p dir="auto">If pictures may help, please let me know how to upload them (could not find a way to do that).</p>
<p dir="auto">Thanks.</p>
]]></description><link>https://forum.qt.io/post/390211</link><guid isPermaLink="true">https://forum.qt.io/post/390211</guid><dc:creator><![CDATA[Raphy]]></dc:creator><pubDate>Thu, 27 Apr 2017 10:57:43 GMT</pubDate></item><item><title><![CDATA[Reply to QFileDialog File&#x2F;Directory field gets truncated on Mon, 24 Apr 2017 13:30:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ni.sumi">@<bdi>Ni.Sumi</bdi></a><br />
Thank you for your reply.<br />
I may have not explained well the problem. The strange behavior I described is <em>inside</em> QFileDialog,<br />
not after it is closed. It is a weird behavior that occurs while trying to select a directory. There seems to be no interference in QFileDialog behavior from the outside. I have other such dialogs in other parts of my application and they behave properly.<br />
I was thinking that if someone else came across this kind of behavior and figured out what went wrong, that could give me a hint as for where to look into.</p>
]]></description><link>https://forum.qt.io/post/389708</link><guid isPermaLink="true">https://forum.qt.io/post/389708</guid><dc:creator><![CDATA[Raphy]]></dc:creator><pubDate>Mon, 24 Apr 2017 13:30:10 GMT</pubDate></item><item><title><![CDATA[Reply to QFileDialog File&#x2F;Directory field gets truncated on Mon, 24 Apr 2017 13:04:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/raphy">@<bdi>Raphy</bdi></a></p>
<p dir="auto">If possible, post the piece of the code. It would be easy to find the error.  :)</p>
<p dir="auto">Edit:</p>
<p dir="auto">Mostly these couple of lines  will do , what you are looking.</p>
<pre><code>QString file = QFileDialog::getOpenFileName();
 QDir dir = QFileInfo(file).absoluteDir();
qDebug() &lt;&lt; dir;
</code></pre>
]]></description><link>https://forum.qt.io/post/389669</link><guid isPermaLink="true">https://forum.qt.io/post/389669</guid><dc:creator><![CDATA[Ni.Sumi]]></dc:creator><pubDate>Mon, 24 Apr 2017 13:04:34 GMT</pubDate></item></channel></rss>