QDesktopServices QML Type

Provides methods for accessing common desktop services. More...

Import Statement: import scripting .

Methods

Detailed Description

Many desktop environments provide services that can be used by applications to perform common tasks, such as opening a file, in a way that is both consistent and takes into account the user's application preferences.

This object contains methods that provide simple interfaces to these services that indicate whether they succeeded or failed.

The openUrl() method is used to open files located at arbitrary URLs in external applications. For URLs that correspond to resources on the local filing system (where the URL scheme is "file"), a suitable application is used to open the file.

The displayName() and storageLocation() methods take one of the following enums as an argument:

  • DesktopServices.DesktopLocation
  • DesktopServices.DocumentsLocation
  • DesktopServices.FontsLocation
  • DesktopServices.ApplicationsLocation
  • DesktopServices.MusicLocation
  • DesktopServices.MoviesLocation
  • DesktopServices.PicturesLocation
  • DesktopServices.TempLocation
  • DesktopServices.HomeLocation
  • DesktopServices.DataLocation
  • DesktopServices.CacheLocation
  • DesktopServices.GenericDataLocation
  • DesktopServices.RuntimeLocation
  • DesktopServices.ConfigLocation
  • DesktopServices.DownloadLocation
  • DesktopServices.GenericCacheLocation
  • DesktopServices.GenericConfigLocation

The enum values correspond to the values of the QStandardPaths::StandardLocation enum with the same names.

Method Documentation

string displayName(int location)

Returns a localized display name for the specified location or an empty QString if no relevant location can be found.


boolean openUrl(string url)

Uses the URL scheme file to open the specified url with a suitable application.

Warning: A return value of true indicates that the installer has successfully requested the operating system to open the URL in an external application. It may still fail to launch or fail to open the requested URL. This result will not be reported back to the installer.


string storageLocation(int location)

Returns the specified location.