本页内容

QOpcUaLocalizedText Class

OPC UA 的 LocalizedText 类型。更多内容...

头文件: #include <QOpcUaLocalizedText>
CMake: find_package(Qt6 REQUIRED COMPONENTS OpcUa)
target_link_libraries(mytarget PRIVATE Qt6::OpcUa)
qmake: QT += opcua

属性

公开职能

QOpcUaLocalizedText()
QOpcUaLocalizedText(const QString &locale, const QString &text)
QOpcUaLocalizedText(const QOpcUaLocalizedText &rhs)
QString locale() const
void setLocale(const QString &locale)
void setText(const QString &text)
QString text() const
operator QVariant() const
QOpcUaLocalizedText &operator=(const QOpcUaLocalizedText &rhs)
bool operator==(const QOpcUaLocalizedText &rhs) const
(since 6.3) QDebug operator<<(QDebug debug, const QOpcUaLocalizedText &text)

详细说明

这是对 OPC UA 1.05 第 3 部分 8.5 节中定义的 OPC UA LocalizedText 类型的Qt OPC UA 表示形式。一个 LocalizedText 值包含一个文本字符串,其关联的区域设置信息以第二个字符串的形式给出(例如“en”或“en-US”)。 区域设置信息字符串的格式为 <语言>[-<国家/地区>]。语言通常采用 ISO 639 两位字母代码表示,国家/地区采用 ISO 3166 两位字母代码表示。 也允许使用自定义代码(参见 OPC UA 1.05 第 3 部分,8.4)。它可用于通过 LocalizedText 元素数组为一个值提供多种不同语言的文本字符串。

属性文档

locale : QString

所含文本的区域设置。该值必须采用修改后的 ISO 标准表示法,例如en-US 。详情请参阅 OPC UA 规范 1.05 第 3 部分第 8.4 节。

访问函数:

QString locale() const
void setLocale(const QString &locale)

text : QString

文本内容。

访问函数:

QString text() const
void setText(const QString &text)

成员函数文档

QOpcUaLocalizedText::QOpcUaLocalizedText()

Default 会构建一个未设置任何参数的本地化文本。

QOpcUaLocalizedText::QOpcUaLocalizedText(const QString &locale, const QString &text)

根据区域设置locale 和文本text 生成本地化文本。

QOpcUaLocalizedText::QOpcUaLocalizedText(const QOpcUaLocalizedText &rhs)

根据rhs 生成本地化文本。

QString QOpcUaLocalizedText::locale() const

返回区域设置。

注意: 这是 locale 属性的获取 函数。

另请参阅 ` setLocale()`。

void QOpcUaLocalizedText::setLocale(const QString &locale)

将区域设置为locale 。

注意: 这是属性locale 的设置 函数。

另请参阅 locale()。

void QOpcUaLocalizedText::setText(const QString &text)

将文本设置为text 。

注意: 这是属性text 的设置 函数。

另请参阅 text()。

QString QOpcUaLocalizedText::text() const

返回该文本。

注意: 这是属性 text 的获取 函数。

另请参阅 setText()。

QOpcUaLocalizedText::operator QVariant() const

将此本地化文本转换为QVariant 。

QOpcUaLocalizedText &QOpcUaLocalizedText::operator=(const QOpcUaLocalizedText &rhs)

将rhs 中的值设置为此本地化文本中的值。

bool QOpcUaLocalizedText::operator==(const QOpcUaLocalizedText &rhs) const

如果该本地化文本的值与rhs 相同,则返回true 。

相关非成员

[since 6.3] QDebug operator<<(QDebug debug, const QOpcUaLocalizedText &text)

将本地化的text 写入debug 输出。

该函数于 Qt 6.3 版本中引入。

另请参阅 QDebug 。

© 2026 The Qt Company Ltd. 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.