Category QML Type

The Category type represents a category that a Place can be associated with. More...

Import Statement: import QtLocation 5.15
Since: QtLocation 5.5

Properties

Methods

Detailed Description

Categories are used to search for places based on the categories they are associated with. The list of available categories can be obtained from the CategoryModel. The PlaceSearchModel has a categories property that is used to limit the search results to places with the specified categories.

If the Plugin supports it, categories can be created or removed. To create a new category construct a new Category object and set its properties, then invoke the save() method.

 import QtPositioning 5.5
 import QtLocation 5.6

 Category {
     id: category

     plugin: myPlugin
     name: "New Category"
     visibility: Category.PrivateVisibility
 }
 ...
 category.save();

To remove a category ensure that the plugin and categoryId properties are set and call the remove() method.

See also CategoryModel.

Property Documentation

category : QPlaceCategory

For details on how to use this property to interface between C++ and QML see "Interfaces between C++ and QML Code".


categoryId : string

This property holds the identifier of the category. The categoryId is a string which uniquely identifies this category within the categories plugin.


icon : PlaceIcon

This property holds the image source associated with the category. To display the icon you can use the Image type.


name : string

This property holds string based name of the category.


plugin : Plugin

This property holds the location based service to which the category belongs.


status : enumeration

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

Category.ReadyNo error occurred during the last operation, further operations may be performed on the category.
Category.SavingThe category is currently being saved, no other operations may be performed until the current operation completes.
Category.RemovingThe category is currently being removed, no other operations can be performed until the current operation completes.
Category.ErrorAn error occurred during the last operation, further operations can still be performed on the category.

visibility : enumeration

This property holds the visibility of the category. It can be one of:

Category.UnspecifiedVisibilityThe visibility of the category is unspecified. If saving a category, the plugin will automatically set a default visibility to the category saved in the backend. This default is dependent on the plugin implementation.
Category.DeviceVisibilityThe category is limited to the current device. The category will not be transferred off of the device.
Category.PrivateVisibilityThe category is private to the current user. The category may be transferred to an online service but is only ever visible to the current user.
Category.PublicVisibilityThe category is public.

Note that visibility does not affect how Places associated with the category are displayed in the user-interface of an application on the device. Instead, it defines the sharing semantics of the category.


Method Documentation

string errorString()

Returns a string description of the error of the last operation. If the last operation completed successfully then the string is empty.


void remove()

This method permanently removes the category from the backend service.


void save()

This method saves the category to the backend service.