EditorialModel QML Type

EditorialModel 类型提供了地方志的模型。更多

Import Statement: import QtLocation 6.9
Since: QtLocation 5.5

属性

详细说明

EditorialModel 是一个只读模型,用于获取与Place 相关的社论。通过EditorialModel::place 绑定Place 会启动社论的初始获取。该模型以增量方式执行获取,并与视图(如ListView )结合使用。当视图读到模型中当前的最后一篇社论时,如果有更多社论,就会执行获取以检索更多社论。当收到社论时,视图会自动更新。每次获取的社论数量由batchSize 属性指定。可用的社论总数可通过totalCount 属性访问。

该模型返回以下角色的数据:

角色类型描述
供应商supplier内容的提供者。
用户user提供内容的用户。
归属字符串显示内容时必须显示的署名文本。
urlurl图片的 URL。
图像 ID字符串图片的标识符。
mimeType字符串图片的 MIME 类型。
文本字符串编辑对地点的文字描述。可以是富文本(基于 HTML),也可以是纯文本,具体取决于提供商。
标题字符串社论的标题。
语言字符串社论使用的语言。
日期时间日期时间评论发布的日期和时间。
文本字符串点评对地点的文字描述。可以是丰富的(基于 HTML 的)文本,也可以是纯文本,具体取决于提供商。
语言字符串评论使用的语言。
评分真实评论者对该地点的评分。
评论 ID字符串评论的标识符。
标题字符串评论的标题。

示例

下面的示例显示了如何显示某个地方的社论:

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

该属性表示该地点的社论条目的总数。


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