<?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[How to get the base name from full file path]]></title><description><![CDATA[<p dir="auto">I am using below code</p>
<p dir="auto">QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),<br />
QDir::currentPath(),<br />
tr("txt (*.txt)"));</p>
<p dir="auto">it gives full path  like C:\test\1.txt</p>
<p dir="auto">I need to get only 1.txt how can I get it?</p>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.qt.io/topic/103060/how-to-get-the-base-name-from-full-file-path</link><generator>RSS for Node</generator><lastBuildDate>Thu, 12 Mar 2026 08:16:32 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/103060.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 22 May 2019 06:42:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to get the base name from full file path on Wed, 22 May 2019 07:01:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ayush-gupta">@<bdi>Ayush-Gupta</bdi></a></p>
<p dir="auto">to add a 3rd way.</p>
<pre><code>QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), QDir::currentPath(), tr("txt (*.txt)"));

fileName = QString(fileName.splitRef("/").last());
</code></pre>
]]></description><link>https://forum.qt.io/post/530346</link><guid isPermaLink="true">https://forum.qt.io/post/530346</guid><dc:creator><![CDATA[J.Hilk]]></dc:creator><pubDate>Wed, 22 May 2019 07:01:36 GMT</pubDate></item><item><title><![CDATA[Reply to How to get the base name from full file path on Wed, 22 May 2019 07:40:33 GMT]]></title><description><![CDATA[<pre><code>const QFileInfo info(fileName);
const QString file(info.fileName());
</code></pre>
]]></description><link>https://forum.qt.io/post/530342</link><guid isPermaLink="true">https://forum.qt.io/post/530342</guid><dc:creator><![CDATA[sierdzio]]></dc:creator><pubDate>Wed, 22 May 2019 07:40:33 GMT</pubDate></item><item><title><![CDATA[Reply to How to get the base name from full file path on Wed, 22 May 2019 06:54:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ayush-gupta">@<bdi>Ayush-Gupta</bdi></a><br />
<a href="https://doc.qt.io/qt-5/qfileinfo.html#fileName" target="_blank" rel="noopener noreferrer nofollow ugc">QFileInfo::fileName()</a></p>
]]></description><link>https://forum.qt.io/post/530341</link><guid isPermaLink="true">https://forum.qt.io/post/530341</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Wed, 22 May 2019 06:54:37 GMT</pubDate></item></channel></rss>