IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

CategoryModel QML Type

The CategoryModel type provides a model of the categories supported by a Plugin.

This type was introduced in QtLocation 5.5.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

CategoryModel QML Type

  • Import Statement: import QtLocation 6.5

  • Since:: QtLocation 5.5

  • Group: CategoryModel is part of qml-QtLocation5-places, qml-QtLocation5-places-models

I. Detailed Description

The CategoryModel type provides a model of the categories that are available from the current Plugin. The model supports both a flat list of categories and a hierarchical tree representing category groupings. This can be controlled by the hierarchical property.

The model supports the following roles:

Role

Type

Description

category

Category

Category object for the current item.

parentCategory

Category

Parent category object for the current item. If there is no parent, null is returned.

The following example displays a flat list of all available categories:

 
Sélectionnez
import QtQuick
import QtPositioning
import QtLocation

ListView {
    model: CategoryModel {
        plugin: myPlugin
        hierarchical: false
    }
    delegate: Text { text: category.name }
}

To access the hierarchical category model it is necessary to use a DelegateModel to access the child items.

II. Property Documentation

 

II-1. hierarchical : bool

This property holds whether the model provides a hierarchical tree of categories or a flat list. The default is true.

II-2. plugin : Plugin

This property holds the provider Plugin used by this model.

II-3. [read-only] status : enumeration

This property holds the status of the model. It can be one of:

CategoryModel.Null

No category fetch query has been executed. The model is empty.

CategoryModel.Ready

No error occurred during the last operation, further operations may be performed on the model.

CategoryModel.Loading

The model is being updated, no other operations may be performed until complete.

CategoryModel.Error

An error occurred during the last operation, further operations can still be performed on the model.

III. Signal Documentation

 

III-1. dataChanged()

This signal is emitted when significant changes have been made to the underlying datastore.

Applications should act on this signal at their own discretion. The data provided by the model could be out of date and so the model should be reupdated sometime, however an immediate reupdate may be disconcerting to users if the categories change without any action on their part.

The corresponding handler is onDataChanged.

The corresponding handler is onDataChanged.

IV. Method Documentation

 

IV-1. string errorString()

This read-only property holds the textual presentation of the latest category model error. If no error has occurred, an empty string is returned.

An empty string may also be returned if an error occurred which has no associated textual representation.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+