[Development] Differences: QDesktopServices vs QStandardPaths

Chris W chrisw.qtdevel at psychogeeks.com
Tue Jun 25 23:27:44 CEST 2013


Were the following differences between the paths returned by Qt 4.8
QDesktopServices and 5.1 QStandardPaths intentional or bug-worthy? (They
are annoying either way)

#include <QtCore>
#include <QDesktopServices>
int main(int argc, char **argv)
QCoreApplication app(argc, argv);
QStringList paths =
QString paths =
qDebug() << qVersion() << paths;
return 0;

Outputs under different Qt versions on 64-bit Linux:
4.8.4 "/home/chrisw/.local/share/data/ExampleOrg/ExampleApp"
5.1.0 ("/home/chrisw/.local/share/ExampleOrg/ExampleApp",

Note the extra “data” directory in the Qt4 path vs. the first directory
in Qt5. XDG_DATA_HOME is not set.

This means ported Qt4-based code, when built with Qt5, looks in the
wrong location for data that was previously installed/generated in the
Qt4 DataLocation on deployed machines. As sierdzio points out here
(http://qt-project.org/forums/viewthread/29223/) this is strictly
neither a regression in QDesktopServices nor a bug in QStandardPaths.
Aligning it now would be a regression in Qt5.

Unless there's something I am missing, I will work around it by moving
the data using an installer script, using the deprecated function in
QDesktopServices, or coding alternate paths into the
application startup.

Chris Williams

Life would be much easier if I had the source code.  Anon.

More information about the Development mailing list