Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

EditorialModel

The EditorialModel element provides a model of place editorials. More...

Inherits QtObject

This type was introduced in Qt Location 5.0.

Properties

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:

RoleTypeDescription
textstringThe editorial's textual description of the place. It can be either rich (HTML based) text or plain text depending upon the provider.
titlestringThe title of the editorial.
languagestringThe language that the editorial is written in.
supplierSupplierThe supplier of the editorial.
userUserThe user who contributed the editorial.
attributionstringAttribution text which must be displayed when displaying the editorial.

Example

The following example shows how to display editorials for a place:

 import QtQuick 2.0
 import QtLocation 5.0

 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
             }
         }
     }
 }

Property Documentation

batchSize : int

This property holds the batch size to use when fetching more editorials items.


place : Place

This property holds the Place that the editorials are for.


read-onlytotalCount : int

This property holds the total number of editorial items for the place.


Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web