EditorialModel QML Type
EditorialModel 类型提供了一个用于放置社论的模型。更多内容...
| Import Statement: | import QtLocation 6.12 |
| Since: | QtLocation 5.5 |
属性
- batchSize : int
- place : Place
- totalCount : int
详细说明
EditorialModel 是一个只读模型,用于获取与Place 相关的社论。通过EditorialModel::place 绑定Place 后,将触发社论的初始获取操作。该模型以增量方式进行数据获取,旨在与ListView 等视图配合使用。 当视图到达模型中当前存在的最后一篇社论时,系统会执行一次检索操作以获取更多社论(如果可用)。随着社论的接收,视图会自动更新。每次检索的社论数量由batchSize 属性指定。可通过totalCount 属性获取可用的社论总数。
该模型返回以下角色的数据:
| 角色 | 类型 | 描述 |
|---|---|---|
| supplier | supplier | 内容的提供者。 |
| 用户 | user | 贡献该内容的用户。 |
| 署名 | 字符串 | 在显示内容时必须显示的署名文本。 |
| url | url | 图片的URL。 |
| imageId | 字符串 | 图片的标识符。 |
| mimeType | 字符串 | 图像的 MIME 类型。 |
| text | 字符串 | 编辑部对该地点的文字描述。根据提供商的不同,可以是富文本(基于 HTML)或纯文本。 |
| title | 字符串 | 该评论的标题。 |
| language | 字符串 | 社论的撰写语言。 |
| dateTime | datetime | 评论发布的日期和时间。 |
| text | 字符串 | 评论对该地点的文字描述。根据提供商的不同,可以是富文本(基于HTML)或纯文本。 |
| language | 字符串 | 评论所使用的语言。 |
| rating | 实数 | 评论者对该场所给出的评分。 |
| 评论ID | 字符串 | 该评论的标识符。 |
| title | 字符串 | 评论的标题。 |
示例
以下示例演示了如何显示某个地点的评论:
import QtQuick
import QtPositioning
import QtLocation
EditorialModel {
id: editorialModel
batchSize: 3
place: place
}
ListView {
model: editorialModel
delegate: Item {
anchors.fill: parent
Column {
width: parent.width
clip: true
Text {
text: title
width: parent.width
wrapMode: Text.WordWrap
font.pixelSize: 24
}
Text {
text: text
width: parent.width
wrapMode: Text.WordWrap
font.pixelSize: 20
}
Row {
Image {
width: 16
height: 16
source: supplier.icon.url(Qt.size(width, height), Icon.List)
}
Text {
text: "Provided by " + supplier.name
font.pixelSize: 16
}
}
Text {
text: "Contributed by " + user.name
font.pixelSize: 16
}
Text {
text: attribution
font.pixelSize: 8
}
}
}
}属性文档
batchSize : int
该属性用于存储在获取更多社论项目时使用的批处理大小。
place : Place
该属性用于指定社论的发布对象。
totalCount : int
该属性保存了该地点的编辑条目总数。
© 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.