本页内容

Utils::Id Class

class Utils::Id

Id 类封装了一个在特定运行中的Qt Creator 进程内唯一的标识符。更多内容...

Header: #include <utils/id.h>

公共函数

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(QStringView suffix) const
Utils::Id withSuffix(char suffix) const
Utils::Id withSuffix(const char *suffix) const
Utils::Id withSuffix(int suffix) const

静态公共成员

Utils::Id fromSetting(const QVariant &variant)

详细说明

Utils::Id 用作一种机制,以比普通的QString 或QByteArray 更安全、更快捷的方式来识别感兴趣的对象。

ID 与一个用于显示和持久化的普通 7 位干净 ASCII 名称相关联。

成员函数文档

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

根据持久化值variant 重建一个 ID。

另请参阅 toSetting()。

QByteArrayView Id::name() const

返回该 ID 的内部表示形式。

QString Id::suffixAfter(Utils::Id baseId) const

提取 ID 字符串表示形式的一部分。该函数可用于截取由 `baseId ` 指定的基部,该参数在使用 `withSuffix()` 生成 ID 时会被用到。

另请参阅 withSuffix()。

QVariant Id::toSetting() const

返回一个表示该 ID 的持久化值,该值适合存储在QSettings 中。

另请参阅 fromSetting()。

QString Id::toString() const

返回一个适合在用户界面中显示的 ID 字符串表示形式。

不应使用此方法来创建 ID 的持久化版本,请改用toSetting() 。

另请参阅 fromString() 和toSetting()。

Utils::Id Id::withPrefix(const char *prefix) const

构建一个派生 ID。

这可用于构建逻辑上相互关联的ID组。相关的内部名称将通过在ID前缀添加prefix 来生成。

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

构建一个派生ID。

这可用于构建逻辑上相互关联的ID组。相关的内部名称将通过在ID后追加suffix 来生成。

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

这是一个重载函数。

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

这是一个重载函数。

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

这是一个重载函数。

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

这是一个重载函数。

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.