Obsolete Members for QDesktopServices

以下成員源於類 QDesktopServices 已過時。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。

靜態公共成員

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

成員函數文檔編製

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

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

使用 QStandardPaths::displayName ()

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

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

使用 QStandardPaths::writableLocation ()

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

QDesktopServices::DataLocation was GenericDataLocation + "/data/organization/application" ,而 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).