Id Class | Extending Qt Creator Manual

- Extending Qt Creator Manual
- Id
- Extending Qt Creator Manual 4.12.3

# Id Class

class Core::Id

The Id class encapsulates an identifier that is unique within a specific running Qt Creator process. More...

Header: | #include <Id>

- List of all members, including inherited members
- Obsolete members

## Public Functions

| Id(const char *name)
QByteArray | name() const
QString | suffixAfter(Core::Id baseId) const
QVariant | toSetting() const
QString | toString() const
Core::Id | withPrefix(const char *prefix) const
Core::Id | withSuffix(int suffix) const
Core::Id | withSuffix(const char *suffix) const
Core::Id | withSuffix(const QString &suffix) const

## Static Public Members

Core::Id | fromSetting(const QVariant &variant)

## Detailed Description

`Core::Id` is used as facility to identify objects of interest in a more typesafe and faster manner than a plain QString or QByteArray would provide.

An id is associated with a plain 7-bit-clean ASCII name used for display and persistency.

## Member Function Documentation

### Id::Id(const char *name)

Constructs an id given its associated name. The internal representation will be unspecified, but consistent within a Qt Creator process.

### `[static]` Core::Id Id::fromSetting(const QVariant &variant)

Reconstructs an id from the persistent value variant.

See also toSetting().

### QByteArray Id::name() const

Returns an internal representation of the id.

### QString Id::suffixAfter(Core::Id baseId) const

Extracts a part of the id string representation. This function can be used to split off the base part specified by baseId used when generating an id with `withSuffix()`.

See also withSuffix().

### QVariant Id::toSetting() const

Returns a persistent value representing the id which is suitable to be stored in QSettings.

See also fromSetting().

### QString Id::toString() const

Returns a string representation of the id suitable for UI display.

This should not be used to create a persistent version of the Id, use `toSetting()` instead.

See also fromString() and toSetting().

### Core::Id Id::withPrefix(const char *prefix) const

Constructs a derived id.

This can be used to construct groups of ids logically belonging together. The associated internal name will be generated by prepending prefix.

### Core::Id Id::withSuffix(int suffix) const

Constructs a derived id.

This can be used to construct groups of ids logically belonging together. The associated internal name will be generated by appending suffix.

### Core::Id Id::withSuffix(const char *suffix) const

This is an overloaded function.

### Core::Id Id::withSuffix(const QString &suffix) const

This is an overloaded function.