How to get user's download folder in Qt?

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.


You can use QDir::homePath() to get a QString to the home directory of the current user's profile but I'm not sure that there is a "standard" download directory identified by the OS.

In Qt 4, there is QDesktopServices providing some user paths:

It has e.g. Desktop and Documents but no specific Downloads folder.

In Qt 5, use QStandardPaths:

const QString downloadsFolder = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);

Need Your Help

A field initializer cannot reference the nonstatic field, method, or property


I have a class and when I try to use it in another class I receive the error below.

Use one CTE many times

sql sql-server sql-server-2008 common-table-expression

I have this, and i get an error at set total.