EditorialModel QML Type▲
-
Import Statement: import QtLocation 6.7
-
Since: QtLocation 5.5
-
Group: EditorialModel is part of qml-QtLocation5-places, qml-QtLocation5-places-models
Detailed Description▲
The EditorialModel is a read-only model used to fetch editorials related to a Place. Binding a Place via EditorialModel::place initiates an initial fetch of editorials. The model performs fetches incrementally and is intended to be used in conjunction with a View such as a ListView. When the View reaches the last of the editorials currently in the model, a fetch is performed to retrieve more if they are available. The View is automatically updated as the editorials are received. The number of editorials which are fetched at a time is specified by the batchSize property. The total number of editorials available can be accessed via the totalCount property.
The model returns data for the following roles:
|
Role |
Type |
Description |
|---|---|---|
|
supplier |
The supplier of the content. |
|
|
user |
The user who contributed the content. |
|
|
attribution |
string |
Attribution text which must be displayed when displaying the content. |
|
url |
url |
The URL of the image. |
|
imageId |
string |
The identifier of the image. |
|
mimeType |
string |
The MIME type of the image. |
|
text |
string |
The editorial's textual description of the place. It can be either rich (HTML based) text or plain text depending upon the provider. |
|
title |
string |
The title of the editorial. |
|
language |
string |
The language that the editorial is written in. |
|
dateTime |
datetime |
The date and time that the review was posted. |
|
text |
string |
The review's textual description of the place. It can be either rich (HTML based) text or plain text depending on the provider. |
|
language |
string |
The language that the review is written in. |
|
rating |
real |
The rating that the reviewer gave to the place. |
|
reviewId |
string |
The identifier of the review. |
|
title |
string |
The title of the review. |
Example▲
The following example shows how to display editorials for a place:
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
}
}
}
}

