Category QML Type
“类别”类型表示“Place ”可以关联到的类别。更多内容...
| Import Statement: | import QtLocation 6.12 |
| Since: | QtLocation 5.5 |
属性
- categoryId : string
- icon : PlaceIcon
- name : string
- plugin : Plugin
- status : enumeration
- visibility : enumeration
方法
- string errorString()
- void remove()
- void save()
详细说明
类别用于根据地点关联的类别来搜索地点。可用的类别列表可从CategoryModel 获取。PlaceSearchModel 具有一个categories 属性,用于将搜索结果限制为具有指定类别的地点。
如果Plugin 支持该功能,则可以创建或删除类别。要创建新类别,请构建一个新的 Category 对象并设置其属性,然后调用save() 方法。
import QtPositioning
import QtLocation
Category {
id: category
plugin: myPlugin
name: "New Category"
visibility: Category.PrivateVisibility
}
...
category.save();要删除类别,请确保已设置plugin 和categoryId 属性,然后调用remove() 方法。
另请参阅 CategoryModel 。
属性文档
categoryId : string
该属性保存了分类的标识符。categoryId 是一个字符串,用于在plugin 中的分类中唯一标识该分类。
icon : PlaceIcon
该属性存储与该类别关联的图像源。要显示图标,可以使用“图像”类型。
name : string
该属性存储类别的字符串名称。
plugin : Plugin
该属性存储了该类别所属的基于位置的服务。
status : enumeration [read-only]
该属性存储了该分类的状态。其取值可以是以下之一:
| Category.Ready | 上次操作未发生错误,可对该类别执行后续操作。 |
| Category.Saving | 该类别当前正在保存中,在当前操作完成之前,不得执行其他操作。 |
| Category.Removing | 该类别当前正在被删除,在当前操作完成之前,无法执行其他操作。 |
| Category.Error | 上一项操作期间发生错误,但仍可对该分类执行后续操作。 |
visibility : enumeration
该属性用于指定分类的可见性。其取值可以是以下之一:
| Category.UnspecifiedVisibility | 该分类的可见性未指定。若保存分类,插件将自动为后端保存的分类设置默认可见性。该默认值取决于插件的具体实现。 |
| Category.DeviceVisibility | 该分类仅限于当前设备。该分类不会从设备中转移出去。 |
| Category.PrivateVisibility | 该分类仅对当前用户可见。该分类可能会传输到在线服务,但仅对当前用户可见。 |
| Category.PublicVisibility | 该类别为公开的。 |
请注意,可见性不会影响与该类别关联的“Place”在设备上应用程序用户界面中的显示方式。相反,它定义了该类别的共享规则。
方法文档
string errorString()
返回对上次操作错误的字符串描述。如果上次操作成功完成,则该字符串为空。
void remove()
此方法会将该分类从后端服务中永久删除。
void save()
该方法将类别保存到后端服务中。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.