- Qt 6.11
- Qt Location
- QML Types
- Category
- Qt 6.11.1 Reference Documentation

# Category QML Type

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

Import Statement: | `import QtLocation 6.11`
Since: | QtLocation 5.5

- List of all members, including inherited members

## Properties

- categoryId : string
- icon : PlaceIcon
- name : string
- plugin : Plugin
- status : enumeration
- visibility : enumeration

## Methods

- string errorString()
- void remove()
- void save()

## 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
     import QtLocation

     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

### 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 `[read-only]`

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

Category.Ready | No error occurred during the last operation, further operations may be performed on the category.
Category.Saving | The category is currently being saved, no other operations may be performed until the current operation completes.
Category.Removing | The category is currently being removed, no other operations can be performed until the current operation completes.
Category.Error | An 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.UnspecifiedVisibility | The 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.DeviceVisibility | The category is limited to the current device. The category will not be transferred off of the device.
Category.PrivateVisibility | The 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.PublicVisibility | The 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.