Obsolete Members for QDesktopServices | Qt GUI 5.12.7

Qt 5.12 | Qt GUI | C++ Classes | QDesktopServices

Qt 5.12.7 Reference Documentation

# Obsolete Members for QDesktopServices

The following members of class QDesktopServices are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

## Static Public Members

`(obsolete)` QString | displayName(QDesktopServices::StandardLocation type)
`(obsolete)` QString | storageLocation(QDesktopServices::StandardLocation type)

## Member Function Documentation

### `[static]` QString QDesktopServices::displayName(QDesktopServices::StandardLocation type)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use QStandardPaths::displayName()

### `[static]` QString QDesktopServices::storageLocation(QDesktopServices::StandardLocation type)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use QStandardPaths::writableLocation()

Note: when porting QDesktopServices::DataLocation to QStandardPaths::DataLocation, a different path will be returned.

`QDesktopServices::DataLocation` was `GenericDataLocation + "/data/organization/application"`, while QStandardPaths::DataLocation is `GenericDataLocation + "/organization/application"`.

Also note that `application` could be empty in Qt 4, if QCoreApplication::setApplicationName() wasn't called, while in Qt 5 it defaults to the name of the executable.

Therefore, if you still need to access the Qt 4 path (for example for data migration to Qt 5), replace

      QDesktopServices::storageLocation(QDesktopServices::DataLocation)

with

      QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
          "/data/organization/application"

(assuming an organization name and an application name were set).