<?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 auto-generate the entries of a QComboBox from file names?]]></title><description><![CDATA[<p dir="auto">I want to add some new functions to a complex Qt project. For this I need to generate the entries of a QComboBox automatically from the names of files, which are located in a certain directory. And as soon as I select one of the entries, the content of the corresponding file should be copied automatically to another file.</p>
<p dir="auto">Example:<br />
A directory c:\dat contains the files: "XYZ-1", "XYZ-2", and "XYZ-3"<br />
So my QComboBox "dat_box" should create the entries "XYZ-1", "XYZ-2", and "XYZ-3".<br />
As soon as I select e.g. "XYZ-2", the content of the file "XYZ-2" shall be copied automatically into an existing file "XYZ" (and replace its content).</p>
<p dir="auto">How can I program this? (My C++ programming skills are not the best. Please be so kind and explain it well enough or at best give me a concrete example)</p>
]]></description><link>https://forum.qt.io/topic/134446/how-to-auto-generate-the-entries-of-a-qcombobox-from-file-names</link><generator>RSS for Node</generator><lastBuildDate>Mon, 16 Mar 2026 16:08:41 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/134446.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 18 Feb 2022 11:13:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to auto-generate the entries of a QComboBox from file names? on Fri, 18 Feb 2022 14:56:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/urbi">@<bdi>Urbi</bdi></a> said in <a href="/post/703177">How to auto-generate the entries of a QComboBox from file names?</a>:</p>
<blockquote>
<p dir="auto">Do you also know how I can do it to copy the content of the selected file to a specified file?</p>
</blockquote>
<p dir="auto">See <a href="https://doc.qt.io/qt-5/qfile.html#copy-1" target="_blank" rel="noopener noreferrer nofollow ugc">QFile::copy()</a></p>
]]></description><link>https://forum.qt.io/post/703190</link><guid isPermaLink="true">https://forum.qt.io/post/703190</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Fri, 18 Feb 2022 14:56:38 GMT</pubDate></item><item><title><![CDATA[Reply to How to auto-generate the entries of a QComboBox from file names? on Fri, 18 Feb 2022 13:37:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> Thanks, that should work. Do you also know how I can do it to copy the content of the selected file to a specified file?</p>
]]></description><link>https://forum.qt.io/post/703177</link><guid isPermaLink="true">https://forum.qt.io/post/703177</guid><dc:creator><![CDATA[Urbi]]></dc:creator><pubDate>Fri, 18 Feb 2022 13:37:10 GMT</pubDate></item><item><title><![CDATA[Reply to How to auto-generate the entries of a QComboBox from file names? on Fri, 18 Feb 2022 11:51:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/urbi">@<bdi>Urbi</bdi></a> Use <a href="https://doc.qt.io/qt-5/qdir.html#entryList-1" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qdir.html#entryList-1</a> to get a list of all files in the directory and add these files to your combo box.</p>
]]></description><link>https://forum.qt.io/post/703149</link><guid isPermaLink="true">https://forum.qt.io/post/703149</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 18 Feb 2022 11:51:28 GMT</pubDate></item></channel></rss>