Id Class

class Utils::Id

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

Header: #include <utils/id.h>

Public Functions

QByteArrayView name() const
QString suffixAfter(Utils::Id baseId) const
QVariant toSetting() const
QString toString() const
Utils::Id withPrefix(const char *prefix) const
Utils::Id withSuffix(qsizetype suffix) const
Utils::Id withSuffix(int suffix) const
Utils::Id withSuffix(char suffix) const
Utils::Id withSuffix(const char *suffix) const
Utils::Id withSuffix(QStringView suffix) const

Static Public Members

Utils::Id fromSetting(const QVariant &variant)

Detailed Description

Utils::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

[static] Utils::Id Id::fromSetting(const QVariant &variant)

Reconstructs an id from the persistent value variant.

See also toSetting().

QByteArrayView Id::name() const

Returns an internal representation of the id.

QString Id::suffixAfter(Utils::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().

Utils::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.

Utils::Id Id::withSuffix(qsizetype 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.

Utils::Id Id::withSuffix(int suffix) const

This is an overloaded function.

Utils::Id Id::withSuffix(char suffix) const

This is an overloaded function.

Utils::Id Id::withSuffix(const char *suffix) const

This is an overloaded function.

Utils::Id Id::withSuffix(QStringView suffix) const

This is an overloaded function.

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.