How to get user's download folder in Qt?

Viewed 17471

How do I get the standard system / user paths in Qt?

What I really need is to get the location of the user's Downloads folder.

3 Answers

With Qt 5.15.0, on a fr-FR Linux (Manjaro) :

qDebug() << QStandardPaths::displayName(QStandardPaths::DownloadLocation);

returns :

"Téléchargement"

This is not the actual French "DownloadLocation" folder name, which is called "Téléchargements", with a plural s, because this folder usually contains more than one downloaded file. Btw, English localization seems to be "~/Downloads", according to Qt 5 online help, with the expected plural s.

Therefore, QStandardPaths::DownloadLocation is unreliable in French. If someone may file and follow the bug at Qt, this might help !

Related