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()
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 类。

注意:地点应用程序接口将内容对象视为 "仅检索 "对象。不支持向提供者提交内容的用例。

成员类型文档

QPlaceContent::Collection

QMap<int,QPlaceContent> 的同义词。映射的键是表示内容索引的int 。值是内容对象本身。

Collection 的目的是作为一个容器,用于存储作为页面检索的内容项。这使得开发人员可以跳过页面,例如,索引 0-9 可以存储在集合中,如果用户跳过索引 80-99,这些也可以存储在集合中。

enum QPlaceContent::DataTag

定义内容对象的值条目

常量说明
QPlaceContent::ContentSupplier0提供此内容的供应商
QPlaceContent::ContentUser1提供此内容的用户
QPlaceContent::ContentAttribution2返回富文本属性字符串

注意: 某些供应商可能要求在显示特定内容项目时始终显示该内容项目的属性。

常量说明
QPlaceContent::ImageId3图片的标识符
QPlaceContent::ImageUrl4图片的网址
QPlaceContent::ImageMimeType5图片的 MIME 类型
QPlaceContent::EditorialTitle6社论标题
QPlaceContent::EditorialText7地点的文字描述。根据提供商的不同,文本可以是富文本(基于 HTML 的文本)或纯文本。
QPlaceContent::EditorialLanguage8社论的语言。通常是 2 个字母 ISO 639-1 格式的语言代码。
QPlaceContent::ReviewId9审核的标识符
QPlaceContent::ReviewDateTime10评论提交的日期和时间
QPlaceContent::ReviewTitle11书评标题
QPlaceContent::ReviewText12审核文本。根据提供商的不同,文本可以是富文本(基于 HTML)或纯文本。
QPlaceContent::ReviewLanguage13审核语言。通常是 2 个字母 ISO 639-1 格式的语言代码。
QPlaceContent::ReviewRating14该评论对该地点的评分
QPlaceContent::CustomDataTag1000

enum QPlaceContent::Type

定义内容类型。

常数说明
QPlaceContent::NoType0内容对象为默认构造,可为该内容对象分配任何其他内容类型
QPlaceContent::ImageType1内容对象为图片
QPlaceContent::ReviewType2内容对象是评论
QPlaceContent::EditorialType3内容对象为社论
QPlaceContent::CustomType0x0100内容对象为自定义类型

成员函数文档

QPlaceContent::QPlaceContent(QPlaceContent::Type type = NoType)

type 构建一个内容对象。

[noexcept] QPlaceContent::QPlaceContent(const QPlaceContent &other)

构建other 的新副本。

[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 内容对象赋值给 this,并返回对该内容对象的引用。

bool QPlaceContent::operator==(const QPlaceContent &other) const

如果此内容对象等同于other ,则返回 true,否则返回 false。

© 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.