IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

StandardPaths QML Type

Provides access to the standard system paths.

This type was introduced in Qt 5.8.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

StandardPaths QML Type

  • Import Statement: import Qt.labs.platform

  • Since:: Qt 5.8

  • Inherits:: QtObject

Detailed Description

Use QtCore::StandardPaths instead.

The StandardPaths singleton type provides methods for querying the standard system paths. The standard paths are mostly useful in conjunction with the FileDialog and FolderDialog types.

 
Sélectionnez
FileDialog {
    folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
}

Types in Qt.labs modules are not guaranteed to remain compatible in future versions.

See Also

Method Documentation

 

string displayName(StandardLocation type)

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

See Also

url findExecutable(string executableName, list<string> paths)

Finds the executable named executableName in the specified paths, or the system paths if paths is empty.

On most operating systems the system path is determined by the PATH environment variable. The directories where to search for the executable can be set in the paths argument. To search in both your own paths and the system paths, call findExecutable twice, once with paths set and once with paths empty. Symlinks are not resolved in order to preserve behavior for the case of executables whose behavior depends on the name they are invoked with .

On Windows, the usual executable extensions (from the PATHEXT environment variable) are automatically appended. For example, the findExecutable("foo") call finds foo.exe or foo.bat if present.

Returns the absolute file path to the executable, or an empty string if not found.

If the given \n executableName is an absolute path pointing to an executable its clean path is returned.

See Also

url locate(StandardLocation type, string fileName, LocateOptions options)

Finds a file or directory called fileName in the standard locations for type.

The options flag lets you specify whether to look for files or directories. By default, this flag is set to LocateFile.

Returns the absolute path to the first file or directory found, otherwise returns an empty string.

See Also

list<url> locateAll(StandardLocation type, string fileName, LocateOptions options)

Finds all files or directories by the name, fileName, in the standard locations for type.

The options flag lets you specify whether to look for files or directories. By default, this flag is set to LocateFile.

Returns the list of all the files that were found.

See Also

void setTestModeEnabled(bool testMode)

If testMode is true, this enables a special "test mode" in QStandardPaths, which changes writable locations to point to test directories. This prevents auto tests from reading or writing to the current user's configuration.

It affects the locations into which test programs might write files: GenericDataLocation, AppDataLocation, ConfigLocation, GenericConfigLocation, AppConfigLocation, GenericCacheLocation, and CacheLocation. Other locations are not affected.

On Unix, XDG_DATA_HOME is set to ~/.qttest/share, XDG_CONFIG_HOME is set to ~/.qttest/config, and XDG_CACHE_HOME is set to ~/.qttest/cache.

On macOS, data goes to ~/.qttest/Application Support, cache goes to ~/.qttest/Cache, and config goes to ~/.qttest/Preferences.

On Windows, everything goes to a "qttest" directory under %APPDATA%.

See Also

list<url> standardLocations(StandardLocation type)

Returns all the directories where files of type belong.

The list of directories is sorted from high to low priority, starting with writableLocation() if it can be determined. This list is empty if no locations for type are defined.

See Also

url writableLocation(StandardLocation type)

Returns the directory where files of type should be written to, or an empty string if the location cannot be determined.

The storage location returned may not exist; that is, it may need to be created by the system or the user.

See Also

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+