<?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[QDir::entryInfoList() not returning files with accents in Qt 5.10+]]></title><description><![CDATA[<p dir="auto">A Mac user of my <a href="https://www.inviska.com/rename/" target="_blank" rel="noopener noreferrer nofollow ugc">rename software</a> reported that files with accents in the name weren't showing up in the file list after I changed Qt version.  Investigating the issue, I started to think it was a problem with <code>QDir</code> in Qt 5.10+.</p>
<p dir="auto">I produced a simple program to display the output of <code>QDir::entryInfoList()</code> in a <code>QTextEdit</code>.  I sent him versions of this program built with Qt 5.9.0 and Qt 5.12.2.  He tested the two builds with a directory containing ten files, half of which had accents in the name.  When he runs the Qt 5.9.0 build all ten files show up:</p>
<p dir="auto"><img src="https://www.inviska.com/files/temp/qdirtest/QDirTest590.png" alt="alt text" class=" img-fluid img-markdown" /></p>
<p dir="auto">However, only six files are returned by <code>QDir::entryInfoList()</code> when he runs the Qt 5.12.2 build, and four of the files containing accents are missing:</p>
<p dir="auto"><img src="https://www.inviska.com/files/temp/qdirtest/QDirTest5122.png" alt="alt text" class=" img-fluid img-markdown" /></p>
<p dir="auto">This issue only happens on the user's computer.  When I test on the Mac with the same ten files they all show up in all versions of Qt, as you can see in <a href="https://www.inviska.com/files/temp/qdirtest/QDirTest.png" target="_blank" rel="noopener noreferrer nofollow ugc">this screenshot</a>.  I wondered if it was an issue related to locale, so I changed my Region and Language to French, but I still couldn't recreate the problem.</p>
<p dir="auto">The project for the test program can be downloaded <a href="https://www.inviska.com/files/temp/qdirtest/QDirTest.zip" target="_blank" rel="noopener noreferrer nofollow ugc">here</a> and the builds I used for testing are <a href="https://www.inviska.com/files/temp/qdirtest/builds/" target="_blank" rel="noopener noreferrer nofollow ugc">here</a>.  I'll paste the code for the test project below as well.</p>
<p dir="auto">main.cpp</p>
<pre><code>#include &lt;QApplication&gt;
#include "Dialog.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    Dialog dialog;
    return app.exec();
}
</code></pre>
<p dir="auto">Dialog.h</p>
<pre><code>#ifndef DIALOG_H
#define DIALOG_H

#include &lt;QDialog&gt;
#include &lt;QTextEdit&gt;

class Dialog : public QDialog
{
    Q_OBJECT
private:
    QTextEdit* dirContents;

public:
    Dialog();

private slots:
    void OpenDir();

private:
    void ReadDir(QString path);
};

#endif // DIALOG_H
</code></pre>
<p dir="auto">Dialog.cpp</p>
<pre><code>#include &lt;QtWidgets&gt;
#include "Dialog.h"


Dialog::Dialog()
{
    dirContents = new QTextEdit(this);
    QPushButton* openDir = new QPushButton(tr("Open Directory"), this);
    QVBoxLayout* layout = new QVBoxLayout(this);
    layout-&gt;addWidget(dirContents);
    layout-&gt;addWidget(openDir);
    setLayout(layout);

    dirContents-&gt;setReadOnly(true);
    setWindowTitle(QString("Qt %1").arg(QT_VERSION_STR));
    connect(openDir, SIGNAL(clicked()), this, SLOT(OpenDir()));
    show();
}


void Dialog::OpenDir()
{
    QFileDialog fileDlg(this);
    fileDlg.setFileMode(QFileDialog::Directory);
    fileDlg.setOptions(QFileDialog::ShowDirsOnly);
    fileDlg.setWindowTitle(tr("Open Directory"));
    fileDlg.setDirectory(QDir::homePath());
    if (fileDlg.exec())
        ReadDir(fileDlg.selectedFiles().at(0));
}


void Dialog::ReadDir(QString path)
{
    QDir dir(path);
    dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot);
    dir.setSorting(QDir::Name | QDir::DirsFirst | QDir::LocaleAware);
    QFileInfoList fileList = dir.entryInfoList();

    dirContents-&gt;clear();
    dirContents-&gt;append(QString("%1\nNum Files: %2\n").arg(QDir::toNativeSeparators(path)).arg(fileList.size()));

    QFileInfoList::const_iterator file;
    for (file = fileList.constBegin() ; file != fileList.constEnd() ; ++file)
        dirContents-&gt;append(file-&gt;fileName());
}

</code></pre>
<p dir="auto">Can anyone suggest why files aren't showing up on the user's computer with Qt 5.10+?  Is it something I'm doing wrong or is it likely a Qt problem?</p>
]]></description><link>https://forum.qt.io/topic/103656/qdir-entryinfolist-not-returning-files-with-accents-in-qt-5-10</link><generator>RSS for Node</generator><lastBuildDate>Mon, 22 Jun 2026 17:35:05 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/103656.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 Jun 2019 13:18:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QDir::entryInfoList() not returning files with accents in Qt 5.10+ on Sun, 09 Jun 2019 00:48:12 GMT]]></title><description><![CDATA[<p dir="auto">He's working with files in his User directory on his main disk.</p>
<p dir="auto">I'm not sure about his file system.  It'll be either HFS+ or APFS but I'd have to check which.</p>
<p dir="auto">He may have changed some settings, but it's hard to imagine any setting would result in a situation where Qt 5.9.0 builds works while Qt 5.10+ builds omit files.</p>
<p dir="auto">He originally reported the problem over a year ago when he was using macOS 10.13 and he's still experiencing the same issue on 10.14.  Programs built with Qt 5.9 work fine, but with Qt 5.10+ files with accents don't show up on his machine.</p>
]]></description><link>https://forum.qt.io/post/533893</link><guid isPermaLink="true">https://forum.qt.io/post/533893</guid><dc:creator><![CDATA[Inviska]]></dc:creator><pubDate>Sun, 09 Jun 2019 00:48:12 GMT</pubDate></item><item><title><![CDATA[Reply to QDir::entryInfoList() not returning files with accents in Qt 5.10+ on Sat, 08 Jun 2019 21:49:01 GMT]]></title><description><![CDATA[<p dir="auto">Hi and welcome to devnet,</p>
<p dir="auto">Does you user have that issue on all its disks or is it happening on for example a network drive ?<br />
What filesystem is he using ?<br />
Did he modify anything in his Windows machine settings ?</p>
]]></description><link>https://forum.qt.io/post/533884</link><guid isPermaLink="true">https://forum.qt.io/post/533884</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Sat, 08 Jun 2019 21:49:01 GMT</pubDate></item></channel></rss>