Struct qt_core::q_settings::Format

source ·
pub struct Format(/* private fields */);
Expand description

This enum type specifies the storage format used by QSettings.

C++ enum: QSettings::Format.

C++ documentation:

This enum type specifies the storage format used by QSettings.

On Unix, NativeFormat and IniFormat mean the same thing, except that the file extension is different (.conf for NativeFormat, .ini for IniFormat).

The INI file format is a Windows file format that Qt supports on all platforms. In the absence of an INI standard, we try to follow what Microsoft does, with the following exceptions:

  • If you store types that QVariant can't convert to QString (e.g., QPoint, QRect, and QSize), Qt uses an @-based syntax to encode the type. For example:

    pos = @Point(100 100)

    To minimize compatibility issues, any @ that doesn't appear at the first position in the value or that isn't followed by a Qt type (Point, Rect, Size, etc.) is treated as a normal character.

  • Although backslash is a special character in INI files, most Windows applications don't escape backslashes (\) in file paths:

    windir = C:\Windows

    QSettings always treats backslash as a special character and provides no API for reading or writing such entries.

  • The INI file format has severe restrictions on the syntax of a key. Qt works around this by using % as an escape character in keys. In addition, if you save a top-level setting (a key with no slashes in it, e.g., "someKey"), it will appear in the INI file's "General" section. To avoid overwriting other keys, if you save something using a key such as "General/someKey", the key will be located in the "%General" section, not in the "General" section.
  • Following the philosophy that we should be liberal in what we accept and conservative in what we generate, QSettings will accept Latin-1 encoded INI files, but generate pure ASCII files, where non-ASCII values are encoded using standard INI escape sequences. To make the INI files more readable (but potentially less compatible), call setIniCodec().

See also registerFormat() and setPath().

Implementations§

source§

impl Format

source

pub fn to_int(&self) -> c_int

source§

impl Format

source

pub const NativeFormat: Format = _

Store the settings using the most appropriate storage format for the platform. On Windows, this means the system registry; on macOS and iOS, this means the CFPreferences API; on Unix, this means textual configuration files in INI format. (C++ enum variant: NativeFormat = 0)

source

pub const IniFormat: Format = _

Store the settings in INI files. (C++ enum variant: IniFormat = 1)

source

pub const InvalidFormat: Format = _

Special value returned by registerFormat(). (C++ enum variant: InvalidFormat = 16)

source

pub const CustomFormat1: Format = _

C++ enum variant: CustomFormat1 = 17

source

pub const CustomFormat2: Format = _

C++ enum variant: CustomFormat2 = 18

source

pub const CustomFormat3: Format = _

C++ enum variant: CustomFormat3 = 19

source

pub const CustomFormat4: Format = _

C++ enum variant: CustomFormat4 = 20

source

pub const CustomFormat5: Format = _

C++ enum variant: CustomFormat5 = 21

source

pub const CustomFormat6: Format = _

C++ enum variant: CustomFormat6 = 22

source

pub const CustomFormat7: Format = _

C++ enum variant: CustomFormat7 = 23

source

pub const CustomFormat8: Format = _

C++ enum variant: CustomFormat8 = 24

source

pub const CustomFormat9: Format = _

C++ enum variant: CustomFormat9 = 25

source

pub const CustomFormat10: Format = _

C++ enum variant: CustomFormat10 = 26

source

pub const CustomFormat11: Format = _

C++ enum variant: CustomFormat11 = 27

source

pub const CustomFormat12: Format = _

C++ enum variant: CustomFormat12 = 28

source

pub const CustomFormat13: Format = _

C++ enum variant: CustomFormat13 = 29

source

pub const CustomFormat14: Format = _

C++ enum variant: CustomFormat14 = 30

source

pub const CustomFormat15: Format = _

C++ enum variant: CustomFormat15 = 31

source

pub const CustomFormat16: Format = _

C++ enum variant: CustomFormat16 = 32

Trait Implementations§

source§

impl Clone for Format

source§

fn clone(&self) -> Format

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 Format

source§

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

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

impl From<Format> for c_int

source§

fn from(value: Format) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Format

source§

fn from(value: c_int) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Format

source§

fn eq(&self, other: &Format) -> 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 Format

source§

impl Eq for Format

source§

impl StructuralEq for Format

source§

impl StructuralPartialEq for Format

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.