pub struct StandardLocation(/* private fields */);
Expand description

This enum describes the different locations that can be queried using methods such as QStandardPaths::writableLocation, QStandardPaths::standardLocations, and QStandardPaths::displayName.

C++ enum: QStandardPaths::StandardLocation.

C++ documentation:

This enum describes the different locations that can be queried using methods such as QStandardPaths::writableLocation, QStandardPaths::standardLocations, and QStandardPaths::displayName.

Some of the values in this enum represent a user configuration. Such enum values will return the same paths in different applications, so they could be used to share data with other applications. Other values are specific to this application. Each enum value in the table below describes whether it's application-specific or generic.

Application-specific directories should be assumed to be unreachable by other applications. Therefore, files placed there might not be readable by other applications, even if run by the same user. On the other hand, generic directories should be assumed to be accessible by all applications run by this user, but should still be assumed to be unreachable by applications by other users.

Data interchange with other users is out of the scope of QStandardPaths.

The following table gives examples of paths on different operating systems. The first path is the writable path (unless noted). Other, additional paths, if any, represent non-writable locations.

Path typemacOSWindows
DesktopLocation"~/Desktop""C:/Users/<USER>/Desktop"
DocumentsLocation"~/Documents""C:/Users/<USER>/Documents"
FontsLocation"/System/Library/Fonts" (not writable)"C:/Windows/Fonts" (not writable)
ApplicationsLocation"/Applications" (not writable)"C:/Users/<USER>/AppData/Roaming/Microsoft/Windows/Start Menu/Programs"
MusicLocation"~/Music""C:/Users/<USER>/Music"
MoviesLocation"~/Movies""C:/Users/<USER>/Videos"
PicturesLocation"~/Pictures""C:/Users/<USER>/Pictures"
TempLocationrandomly generated by the OS"C:/Users/<USER>/AppData/Local/Temp"
HomeLocation"~""C:/Users/<USER>"
DataLocation"~/Library/Application Support/<APPNAME>", "/Library/Application Support/<APPNAME>". "<APPDIR>/../Resources""C:/Users/<USER>/AppData/Local/<APPNAME>", "C:/ProgramData/<APPNAME>", "<APPDIR>", "<APPDIR>/data"
CacheLocation"~/Library/Caches/<APPNAME>", "/Library/Caches/<APPNAME>""C:/Users/<USER>/AppData/Local/<APPNAME>/cache"
GenericDataLocation"~/Library/Application Support", "/Library/Application Support""C:/Users/<USER>/AppData/Local", "C:/ProgramData", "<APPDIR>", "<APPDIR>/data"
RuntimeLocation"~/Library/Application Support""C:/Users/<USER>"
ConfigLocation"~/Library/Preferences""C:/Users/<USER>/AppData/Local/<APPNAME>", "C:/ProgramData/<APPNAME>"
GenericConfigLocation"~/Library/Preferences""C:/Users/<USER>/AppData/Local", "C:/ProgramData"
DownloadLocation"~/Downloads""C:/Users/<USER>/Documents"
GenericCacheLocation"~/Library/Caches", "/Library/Caches""C:/Users/<USER>/AppData/Local/cache"
AppDataLocation"~/Library/Application Support/<APPNAME>", "/Library/Application Support/<APPNAME>". "<APPDIR>/../Resources""C:/Users/<USER>/AppData/Roaming/<APPNAME>", "C:/ProgramData/<APPNAME>", "<APPDIR>", "<APPDIR>/data"
AppLocalDataLocation"~/Library/Application Support/<APPNAME>", "/Library/Application Support/<APPNAME>". "<APPDIR>/../Resources""C:/Users/<USER>/AppData/Local/<APPNAME>", "C:/ProgramData/<APPNAME>", "<APPDIR>", "<APPDIR>/data"
AppConfigLocation"~/Library/Preferences/<APPNAME>""C:/Users/<USER>/AppData/Local/<APPNAME>", "C:/ProgramData/<APPNAME>"
Path typeLinux
DesktopLocation"~/Desktop"
DocumentsLocation"~/Documents"
FontsLocation"~/.fonts"
ApplicationsLocation"~/.local/share/applications", "/usr/local/share/applications", "/usr/share/applications"
MusicLocation"~/Music"
MoviesLocation"~/Videos"
PicturesLocation"~/Pictures"
TempLocation"/tmp"
HomeLocation"~"
DataLocation"~/.local/share/<APPNAME>", "/usr/local/share/<APPNAME>", "/usr/share/<APPNAME>"
CacheLocation"~/.cache/<APPNAME>"
GenericDataLocation"~/.local/share", "/usr/local/share", "/usr/share"
RuntimeLocation"/run/user/<USER>"
ConfigLocation"~/.config", "/etc/xdg"
GenericConfigLocation"~/.config", "/etc/xdg"
DownloadLocation"~/Downloads"
GenericCacheLocation"~/.cache"
AppDataLocation"~/.local/share/<APPNAME>", "/usr/local/share/<APPNAME>", "/usr/share/<APPNAME>"
AppLocalDataLocation"~/.local/share/<APPNAME>", "/usr/local/share/<APPNAME>", "/usr/share/<APPNAME>"
AppConfigLocation"~/.config/<APPNAME>", "/etc/xdg/<APPNAME>"
Path typeAndroidiOS
DesktopLocation"<APPROOT>/files""<APPROOT>/Documents/Desktop"
DocumentsLocation"<USER>/Documents", "<USER>/<APPNAME>/Documents""<APPROOT>/Documents"
FontsLocation"/system/fonts" (not writable)"<APPROOT>/Library/Fonts"
ApplicationsLocationnot supported (directory not readable)not supported
MusicLocation"<USER>/Music", "<USER>/<APPNAME>/Music""<APPROOT>/Documents/Music"
MoviesLocation"<USER>/Movies", "<USER>/<APPNAME>/Movies""<APPROOT>/Documents/Movies"
PicturesLocation"<USER>/Pictures", "<USER>/<APPNAME>/Pictures""<APPROOT>/Documents/Pictures", "assets-library://"
TempLocation"<APPROOT>/cache""<APPROOT>/tmp"
HomeLocation"<APPROOT>/files""<APPROOT>" (not writable)
DataLocation"<APPROOT>/files", "<USER>/<APPNAME>/files""<APPROOT>/Library/Application Support"
CacheLocation"<APPROOT>/cache", "<USER>/<APPNAME>/cache""<APPROOT>/Library/Caches"
GenericDataLocation"<USER>""<APPROOT>/Documents"
RuntimeLocation"<APPROOT>/cache"not supported
ConfigLocation"<APPROOT>/files/settings""<APPROOT>/Library/Preferences"
GenericConfigLocation"<APPROOT>/files/settings" (there is no shared settings)"<APPROOT>/Library/Preferences"
DownloadLocation"<USER>/Downloads", "<USER>/<APPNAME>/Downloads""<APPROOT>/Documents/Downloads"
GenericCacheLocation"<APPROOT>/cache" (there is no shared cache)"<APPROOT>/Library/Caches"
AppDataLocation"<APPROOT>/files", "<USER>/<APPNAME>/files""<APPROOT>/Library/Application Support"
AppConfigLocation"<APPROOT>/files/settings""<APPROOT>/Library/Preferences/<APPNAME>"
AppLocalDataLocation"<APPROOT>/files", "<USER>/<APPNAME>/files""<APPROOT>/Library/Application Support"

In the table above, <APPNAME> is usually the organization name, the application name, or both, or a unique name generated at packaging. Similarly, <APPROOT> is the location where this application is installed (often a sandbox). <APPDIR> is the directory containing the application executable.

The paths above should not be relied upon, as they may change according to OS configuration, locale, or they may change in future Qt versions.

Note: On Android, applications with open files on the external storage (<USER> locations), will be killed if the external storage is unmounted.

Note: On iOS, if you do pass QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).last() as argument to QFileDialog::setDirectory(), a native image picker dialog will be used for accessing the user's photo album. The filename returned can be loaded using QFile and related APIs. This feature was added in Qt 5.5.

See also writableLocation(), standardLocations(), displayName(), locate(), and locateAll().

Implementations§

source§

impl StandardLocation

source

pub fn to_int(&self) -> c_int

source§

impl StandardLocation

source

pub const DesktopLocation: StandardLocation = _

Returns the user’s desktop directory. This is a generic value. On systems with no concept of a desktop. (C++ enum variant: DesktopLocation = 0)

source

pub const DocumentsLocation: StandardLocation = _

Returns the directory containing user document files. This is a generic value. The returned path is never empty. (C++ enum variant: DocumentsLocation = 1)

source

pub const FontsLocation: StandardLocation = _

Returns the directory containing user’s fonts. This is a generic value. Note that installing fonts may require additional, platform-specific operations. (C++ enum variant: FontsLocation = 2)

source

pub const ApplicationsLocation: StandardLocation = _

Returns the directory containing the user applications (either executables, application bundles, or shortcuts to them). This is a generic value. Note that installing applications may require additional, platform-specific operations. Files, folders or shortcuts in this directory are platform-specific. (C++ enum variant: ApplicationsLocation = 3)

source

pub const MusicLocation: StandardLocation = _

Returns the directory containing the user’s music or other audio files. This is a generic value. If no directory specific for music files exists, a sensible fallback for storing user documents is returned. (C++ enum variant: MusicLocation = 4)

source

pub const MoviesLocation: StandardLocation = _

Returns the directory containing the user’s movies and videos. This is a generic value. If no directory specific for movie files exists, a sensible fallback for storing user documents is returned. (C++ enum variant: MoviesLocation = 5)

source

pub const PicturesLocation: StandardLocation = _

Returns the directory containing the user’s pictures or photos. This is a generic value. If no directory specific for picture files exists, a sensible fallback for storing user documents is returned. (C++ enum variant: PicturesLocation = 6)

source

pub const TempLocation: StandardLocation = _

Returns a directory where temporary files can be stored. The returned value might be application-specific, shared among other applications for this user, or even system-wide. The returned path is never empty. (C++ enum variant: TempLocation = 7)

source

pub const HomeLocation: StandardLocation = _

Returns the user’s home directory (the same as QDir::homePath()). On Unix systems, this is equal to the HOME environment variable. This value might be generic or application-specific, but the returned path is never empty. (C++ enum variant: HomeLocation = 8)

source

pub const DataLocation: StandardLocation = _

Returns the same value as AppLocalDataLocation. This enumeration value is deprecated. Using AppDataLocation is preferable since on Windows, the roaming path is recommended. (C++ enum variant: DataLocation = 9)

source

pub const CacheLocation: StandardLocation = _

Returns a directory location where user-specific non-essential (cached) data should be written. This is an application-specific directory. The returned path is never empty. (C++ enum variant: CacheLocation = 10)

source

pub const GenericDataLocation: StandardLocation = _

Returns a directory location where persistent data shared across applications can be stored. This is a generic value. The returned path is never empty. (C++ enum variant: GenericDataLocation = 11)

source

pub const RuntimeLocation: StandardLocation = _

Returns a directory location where runtime communication files should be written, like Unix local sockets. This is a generic value. The returned path may be empty on some systems. (C++ enum variant: RuntimeLocation = 12)

source

pub const ConfigLocation: StandardLocation = _

Returns a directory location where user-specific configuration files should be written. This may be either a generic value or application-specific, and the returned path is never empty. (C++ enum variant: ConfigLocation = 13)

source

pub const DownloadLocation: StandardLocation = _

Returns a directory for user’s downloaded files. This is a generic value. If no directory specific for downloads exists, a sensible fallback for storing user documents is returned. (C++ enum variant: DownloadLocation = 14)

source

pub const GenericCacheLocation: StandardLocation = _

Returns a directory location where user-specific non-essential (cached) data, shared across applications, should be written. This is a generic value. Note that the returned path may be empty if the system has no concept of shared cache. (C++ enum variant: GenericCacheLocation = 15)

source

pub const GenericConfigLocation: StandardLocation = _

Returns a directory location where user-specific configuration files shared between multiple applications should be written. This is a generic value and the returned path is never empty. (C++ enum variant: GenericConfigLocation = 16)

source

pub const AppDataLocation: StandardLocation = _

Returns a directory location where persistent application data can be stored. This is an application-specific directory. To obtain a path to store data to be shared with other applications, use QStandardPaths::GenericDataLocation. The returned path is never empty. On the Windows operating system, this returns the roaming path. This enum value was added in Qt 5.4. (C++ enum variant: AppDataLocation = 17)

source

pub const AppConfigLocation: StandardLocation = _

Returns a directory location where user-specific configuration files should be written. This is an application-specific directory, and the returned path is never empty. This enum value was added in Qt 5.5. (C++ enum variant: AppConfigLocation = 18)

source

pub const AppLocalDataLocation: StandardLocation = _

Returns the local settings path on the Windows operating system. On all other platforms, it returns the same value as AppDataLocation. This enum value was added in Qt 5.4. (C++ enum variant: AppLocalDataLocation = 9)

Trait Implementations§

source§

impl Clone for StandardLocation

source§

fn clone(&self) -> StandardLocation

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for StandardLocation

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<StandardLocation> for c_int

source§

fn from(value: StandardLocation) -> Self

Converts to this type from the input type.
source§

impl From<i32> for StandardLocation

source§

fn from(value: c_int) -> Self

Converts to this type from the input type.
source§

impl PartialEq for StandardLocation

source§

fn eq(&self, other: &StandardLocation) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for StandardLocation

source§

impl Eq for StandardLocation

source§

impl StructuralEq for StandardLocation

source§

impl StructuralPartialEq for StandardLocation

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.