QPlaceContent Class
QPlaceContent 类存储有关地点的内容。更多...
| Header: | #include <QPlaceContent> |
| qmake: | QT += location |
公共类型
| Collection | |
| enum | DataTag { ContentSupplier, ContentUser, ContentAttribution, ImageId, ImageUrl, …, CustomDataTag } |
| enum | Type { NoType, ImageType, ReviewType, EditorialType, CustomType } |
公共函数
| QPlaceContent(QPlaceContent::Type type = NoType) | |
| QPlaceContent(const QPlaceContent &other) | |
| QPlaceContent(QPlaceContent &&other) | |
| ~QPlaceContent() | |
| QList<QPlaceContent::DataTag> | dataTags() const |
| void | setValue(QPlaceContent::DataTag tag, const QVariant &value) |
| QPlaceContent::Type | type() const |
| QVariant | value(QPlaceContent::DataTag tag) const |
| bool | operator!=(const QPlaceContent &other) const |
| QPlaceContent & | operator=(const QPlaceContent &other) |
| bool | operator==(const QPlaceContent &other) const |
详细说明
一个 QPlaceContent 对象包含丰富的内容,例如图片、评论或社论,以及关于内容的属性,例如内容的用户或提供者。 内容对象可能包含多条数据,例如,包含评论的项目通常会包含撰写该评论的用户。使用type()检查 QPlaceContent 对象所代表的内容类型,并使用dataTags()查看其中包含哪些数据。使用value()将单条数据作为QVariant 获取。
注意:某些提供商可能要求在用户查看任何内容时,必须向其显示归属字符串。
地点的丰富内容通常以分页项的形式提供。
目前,QPlaceContent 类不支持第三方扩展。
注意:Places API 将内容对象视为“仅可检索”对象。向提供商提交内容不属于受支持的使用场景。
成员类型文档
QPlaceContent::Collection
QMap<int,QPlaceContent> 的同义词。该映射的键是一个表示内容索引的int ,其值为内容对象本身。
Collection 旨在作为一个容器,用于存储已作为页面检索到的内容项。这使得开发者能够跳过页面——例如,如果索引 0-9 已存储在集合中,当用户跳转到索引 80-99 时,这些内容也可以存储在集合中。
enum QPlaceContent::DataTag
定义内容对象的值条目
| 常量 | 值 | 描述 |
|---|---|---|
QPlaceContent::ContentSupplier | 0 | 提供此内容的供应商 |
QPlaceContent::ContentUser | 1 | 提供此内容的用户 |
QPlaceContent::ContentAttribution | 2 | 返回一个富文本归属字符串 注意:某些 提供商可能要求,在显示特定内容项时,必须始终显示该内容项的归属信息。 |
QPlaceContent::ImageId | 3 | 图片的标识符 |
QPlaceContent::ImageUrl | 4 | 图片的 URL |
QPlaceContent::ImageMimeType | 5 | 图片的 MIME 类型 |
QPlaceContent::EditorialTitle | 6 | 编辑文章的标题 |
QPlaceContent::EditorialText | 7 | 该地点的文字描述。根据提供商的不同,该文本可能是富文本(基于 HTML)或纯文本。 |
QPlaceContent::EditorialLanguage | 8 | 评论的语言。通常为符合 ISO 639-1 标准的 2 字母语言代码。 |
QPlaceContent::ReviewId | 9 | 评论的标识符 |
QPlaceContent::ReviewDateTime | 10 | 评论的提交日期和时间 |
QPlaceContent::ReviewTitle | 11 | 评论的标题 |
QPlaceContent::ReviewText | 12 | 评论正文。根据提供商的不同,正文可以是富文本(基于HTML)或纯文本。 |
QPlaceContent::ReviewLanguage | 13 | 评论的语言。通常采用ISO 639-1标准的两位字母语言代码。 |
QPlaceContent::ReviewRating | 14 | 该评论对该场所的评分 |
QPlaceContent::CustomDataTag | 1000 |
enum QPlaceContent::Type
定义内容类型。
| 常量 | 值 | 描述 |
|---|---|---|
QPlaceContent::NoType | 0 | 该内容对象采用默认构造,可将任何其他内容类型赋值给此内容对象 |
QPlaceContent::ImageType | 1 | 该内容对象为图像 |
QPlaceContent::ReviewType | 2 | 该内容对象是一篇评论 |
QPlaceContent::EditorialType | 3 | 该内容对象是一篇社论 |
QPlaceContent::CustomType | 0x0100 | 该内容对象属于自定义类型 |
成员函数文档
QPlaceContent::QPlaceContent(QPlaceContent::Type type = NoType)
为type 构建一个内容对象。
[noexcept] QPlaceContent::QPlaceContent(const QPlaceContent &other)
创建other 的新副本。
[constexpr noexcept default] QPlaceContent::QPlaceContent(QPlaceContent &&other)
通过Move构造一个QPlaceContent 实例。
[noexcept] QPlaceContent::~QPlaceContent()
销毁内容对象。
QList<QPlaceContent::DataTag> QPlaceContent::dataTags() const
返回存储在此内容对象中的数据标签列表。
void QPlaceContent::setValue(QPlaceContent::DataTag tag, const QVariant &value)
将数据tag 的存储值设置为value 。
另请参阅 value()。
QPlaceContent::Type QPlaceContent::type() const
返回内容类型。
QVariant QPlaceContent::value(QPlaceContent::DataTag tag) const
返回数据tag 中存储的值;如果该标签没有数据,则返回无效的QVariant 。
另请参阅 setValue()。
bool QPlaceContent::operator!=(const QPlaceContent &other) const
如果该内容对象与other 不等价,则返回true;否则返回false。
[noexcept] QPlaceContent &QPlaceContent::operator=(const QPlaceContent &other)
将other 内容对象分配给此对象,并返回对此内容对象的引用。
bool QPlaceContent::operator==(const QPlaceContent &other) const
如果该内容对象与 `other` 等价,则返回 true;否则返回 false。
© 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.