The Category type represents a category that a Place can be associated with. 更多...
import 语句: | import QtLocation 5.12 |
Since: | QtLocation 5.5 |
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 。 PlaceSearchModel 拥有 categories property that is used to limit the search results to places with the specified categories.
若 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() 方法。
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() 方法。
另请参阅 CategoryModel .
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 .
This property holds the image source associated with the category. To display the icon you can use the Image 类型。
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.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 Place s 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.
string errorString () |
Returns a string description of the error of the last operation. If the last operation completed successfully then the string is empty.
This method permanently removes the category from the backend service.
This method saves the category to the backend service.