QNdefNfcSmartPosterRecord Class
QNdefNfcSmartPosterRecord 类提供了一个 NFC RTD-SmartPoster。更多
Header: | #include <QNdefNfcSmartPosterRecord> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Nfc) target_link_libraries(mytarget PRIVATE Qt6::Nfc) |
qmake: | QT += nfc |
自 | Qt 5.2 |
继承: | QNdefRecord |
公共类型
enum | Action { UnspecifiedAction, DoAction, SaveAction, EditAction } |
公共函数
QNdefNfcSmartPosterRecord() | |
QNdefNfcSmartPosterRecord(const QNdefRecord &other) | |
QNdefNfcSmartPosterRecord(const QNdefNfcSmartPosterRecord &other) | |
~QNdefNfcSmartPosterRecord() | |
QNdefNfcSmartPosterRecord::Action | action() const |
void | addIcon(const QNdefNfcIconRecord &icon) |
void | addIcon(const QByteArray &type, const QByteArray &data) |
bool | addTitle(const QNdefNfcTextRecord &text) |
bool | addTitle(const QString &text, const QString &locale, QNdefNfcTextRecord::Encoding encoding) |
bool | hasAction() const |
bool | hasIcon(const QByteArray &mimetype = QByteArray()) const |
bool | hasSize() const |
bool | hasTitle(const QString &locale = QString()) const |
bool | hasTypeInfo() const |
QByteArray | icon(const QByteArray &mimetype = QByteArray()) const |
qsizetype | iconCount() const |
QNdefNfcIconRecord | iconRecord(qsizetype index) const |
QList<QNdefNfcIconRecord> | iconRecords() const |
bool | removeIcon(const QByteArray &type) |
bool | removeIcon(const QNdefNfcIconRecord &icon) |
bool | removeTitle(const QNdefNfcTextRecord &text) |
bool | removeTitle(const QString &locale) |
void | setAction(QNdefNfcSmartPosterRecord::Action act) |
void | setIcons(const QList<QNdefNfcIconRecord> &icons) |
void | setSize(quint32 size) |
void | setTitles(const QList<QNdefNfcTextRecord> &titles) |
void | setTypeInfo(const QString &type) |
void | setUri(const QNdefNfcUriRecord &url) |
void | setUri(const QUrl &url) |
quint32 | size() const |
QString | title(const QString &locale = QString()) const |
qsizetype | titleCount() const |
QNdefNfcTextRecord | titleRecord(qsizetype index) const |
QList<QNdefNfcTextRecord> | titleRecords() const |
QString | typeInfo() const |
QUrl | uri() const |
QNdefNfcUriRecord | uriRecord() const |
QNdefNfcSmartPosterRecord & | operator=(const QNdefNfcSmartPosterRecord &other) |
成员类型文档
enum QNdefNfcSmartPosterRecord::Action
该枚举描述了设备对内容应采取的行动。
常数 | 值 | 说明 |
---|---|---|
QNdefNfcSmartPosterRecord::UnspecifiedAction | -1 | 未定义操作。 |
QNdefNfcSmartPosterRecord::DoAction | 0 | 执行操作(发送短信、启动浏览器、拨打电话)。 |
QNdefNfcSmartPosterRecord::SaveAction | 1 | 保存以备后用(将短信保存在 INBOX 中,将 URI 放在书签中,将电话号码保存在联系人中)。 |
QNdefNfcSmartPosterRecord::EditAction | 2 | 打开编辑(在 SMS 编辑器中打开 SMS,在 URI 编辑器中打开 URI,打开电话号码进行编辑)。 |
成员函数文档
QNdefNfcSmartPosterRecord::QNdefNfcSmartPosterRecord()
构建一个新的空智能海报。
QNdefNfcSmartPosterRecord::QNdefNfcSmartPosterRecord(const QNdefRecord &other)
构建一个新的智能海报,它是other 的副本。
QNdefNfcSmartPosterRecord::QNdefNfcSmartPosterRecord(const QNdefNfcSmartPosterRecord &other)
构建一个新的智能海报,它是other 的副本。
[noexcept]
QNdefNfcSmartPosterRecord::~QNdefNfcSmartPosterRecord()
摧毁智能海报。
QNdefNfcSmartPosterRecord::Action QNdefNfcSmartPosterRecord::action() const
如果有行动记录,则返回行动记录中的行动。否则将返回UnspecifiedAction 。
另请参阅 setAction() 。
void QNdefNfcSmartPosterRecord::addIcon(const QNdefNfcIconRecord &icon)
将图标记录icon 添加到智能海报中。如果智能海报已包含相同类型的图标记录,则现有图标记录将被替换。
void QNdefNfcSmartPosterRecord::addIcon(const QByteArray &type, const QByteArray &data)
在智能海报中添加一个类型为type 、数据为data 的图标记录。如果智能海报已包含相同类型的图标记录,则现有图标记录将被替换。
bool QNdefNfcSmartPosterRecord::addTitle(const QNdefNfcTextRecord &text)
尝试在智能海报中添加标题记录text 。如果智能海报中还没有与标题记录text 相同地域的标题记录,则会添加该标题记录,函数返回true
。否则将返回false
。
bool QNdefNfcSmartPosterRecord::addTitle(const QString &text, const QString &locale, QNdefNfcTextRecord::Encoding encoding)
尝试添加一条新的标题记录,标题为text ,locale 为locale ,编码为encoding 。如果智能海报中还没有包含带有 localelocale 的标题记录,则添加标题记录,函数返回true
。否则将返回false
。
bool QNdefNfcSmartPosterRecord::hasAction() const
如果智能海报包含操作记录,则返回true
,否则返回false
。
bool QNdefNfcSmartPosterRecord::hasIcon(const QByteArray &mimetype = QByteArray()) const
如果智能海报包含使用mimetype 类型的图标记录,则返回true
。如果mimetype 为空,则如果智能海报包含至少一个图标记录,则返回true
。在所有其他情况下,将返回false
。
bool QNdefNfcSmartPosterRecord::hasSize() const
如果智能海报包含大小记录,则返回true
,否则返回false
。
bool QNdefNfcSmartPosterRecord::hasTitle(const QString &locale = QString()) const
如果智能海报包含使用本地语言locale 的标题记录,则返回true
。如果locale 为空,则如果智能海报包含至少一条标题记录,则返回true
。在所有其他情况下,将返回false
。
bool QNdefNfcSmartPosterRecord::hasTypeInfo() const
如果智能海报包含类型记录,则返回true
,否则返回false
。
QByteArray QNdefNfcSmartPosterRecord::icon(const QByteArray &mimetype = QByteArray()) const
如果智能海报包含 MIME 类型为mimetype 的图标记录,则返回相关的图标记录数据。如果mimetype 被省略或为空,则返回第一个图标的记录数据。在所有其他情况下,将返回一个空数组。
qsizetype QNdefNfcSmartPosterRecord::iconCount() const
返回智能海报中包含的图标记录数。
QNdefNfcIconRecord QNdefNfcSmartPosterRecord::iconRecord(qsizetype index) const
返回智能海报内index 索引对应的图标记录,其中index 是介于 0 和iconCount() - 1 之间的值。超出此范围的值将返回空记录。
QList<QNdefNfcIconRecord> QNdefNfcSmartPosterRecord::iconRecords() const
返回智能海报内所有图标记录的副本。
bool QNdefNfcSmartPosterRecord::removeIcon(const QByteArray &type)
尝试从智能海报中删除类型为type 的图标记录。如果智能海报中包含匹配记录,则删除记录并返回true
,否则返回false
。
bool QNdefNfcSmartPosterRecord::removeIcon(const QNdefNfcIconRecord &icon)
尝试从智能海报中删除图标记录icon 。如果智能海报中包含匹配记录,则删除记录并返回true
,否则返回false
。
bool QNdefNfcSmartPosterRecord::removeTitle(const QNdefNfcTextRecord &text)
尝试从智能海报中删除标题记录text 。如果智能海报中包含匹配记录,则删除记录并返回true
,否则返回false
。
bool QNdefNfcSmartPosterRecord::removeTitle(const QString &locale)
尝试从智能海报中移除带有locale 本地语言的标题记录。如果智能海报中包含匹配记录,则删除该记录并返回true
,否则返回false
。
void QNdefNfcSmartPosterRecord::setAction(QNdefNfcSmartPosterRecord::Action act)
将操作记录设置为act
另请参见 action()。
void QNdefNfcSmartPosterRecord::setIcons(const QList<QNdefNfcIconRecord> &icons)
将图标记录列表icons 添加到智能海报中。任何现有记录都将被覆盖。
void QNdefNfcSmartPosterRecord::setSize(quint32 size)
设置记录size 。该值包含 URI 指向的对象的大小(以字节为单位)。
void QNdefNfcSmartPosterRecord::setTitles(const QList<QNdefNfcTextRecord> &titles)
将标题记录列表titles 添加到智能海报中。任何现有记录都会被覆盖。
void QNdefNfcSmartPosterRecord::setTypeInfo(const QString &type)
将类型记录设为type 。type 描述了被uri() 引用的对象的类型。
另请参阅 typeInfo() 。
void QNdefNfcSmartPosterRecord::setUri(const QNdefNfcUriRecord &url)
将 URI 记录设为url
另请参见 uri()。
void QNdefNfcSmartPosterRecord::setUri(const QUrl &url)
构建 URI 记录,并将其在智能海报中的内容设置为url
quint32 QNdefNfcSmartPosterRecord::size() const
如果有大小记录,则返回该记录的大小;否则返回 0。
该值是可选项,包含 URI 指向的对象的大小(以字节为单位)。设备可使用它来确定是否能容纳该对象。
另请参阅 setSize()。
QString QNdefNfcSmartPosterRecord::title(const QString &locale = QString()) const
返回与locale (如果有)locale 相关联的标题记录文本。如果locale 为空,则返回第一个可用记录的标题文本。在所有其他情况下,将返回空字符串。
qsizetype QNdefNfcSmartPosterRecord::titleCount() const
返回智能海报中包含的标题记录数。
QNdefNfcTextRecord QNdefNfcSmartPosterRecord::titleRecord(qsizetype index) const
返回智能海报内index 索引对应的标题记录,其中index 是介于 0 和titleCount() - 1 之间的值。超出此范围的值将返回空记录。
QList<QNdefNfcTextRecord> QNdefNfcSmartPosterRecord::titleRecords() const
返回智能海报内所有标题记录的副本。
QString QNdefNfcSmartPosterRecord::typeInfo() const
返回描述可通过uri() 访问的对象类型的 MIME 类型。
如果类型未知,返回的QString 将为空。
另请参阅 setTypeInfo() 和hasTypeInfo()。
QUrl QNdefNfcSmartPosterRecord::uri() const
如果已设置,则返回智能海报 URI 记录中的 URI。否则返回空 URI。
另请参阅 setUri()。
QNdefNfcUriRecord QNdefNfcSmartPosterRecord::uriRecord() const
如果已设置,则返回智能海报的 URI 记录。否则返回空 URI。
QNdefNfcSmartPosterRecord &QNdefNfcSmartPosterRecord::operator=(const QNdefNfcSmartPosterRecord &other)
将other 智能海报记录分配给此记录,并返回此记录的引用。
© 2025 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.