QPlaceManagerEngine Class
QPlaceManagerEngine 类为希望提供位置功能的QGeoServiceProvider 插件开发者提供了一个接口。更多内容...
| Header: | #include <QPlaceManagerEngine> |
| qmake: | QT += location |
| Inherits: | QObject |
公共函数
| QPlaceManagerEngine(const QVariantMap ¶meters, QObject *parent = nullptr) | |
| virtual | ~QPlaceManagerEngine() |
| virtual QPlaceCategory | category(const QString &categoryId) const |
| virtual QList<QPlaceCategory> | childCategories(const QString &parentId) const |
| virtual QStringList | childCategoryIds(const QString &categoryId) const |
| virtual QPlace | compatiblePlace(const QPlace &original) const |
| virtual QUrl | constructIconUrl(const QPlaceIcon &icon, const QSize &size) const |
| virtual QPlaceContentReply * | getPlaceContent(const QPlaceContentRequest &request) |
| virtual QPlaceDetailsReply * | getPlaceDetails(const QString &placeId) |
| virtual QPlaceReply * | initializeCategories() |
| virtual QList<QLocale> | locales() const |
| QString | managerName() const |
| int | managerVersion() const |
| virtual QPlaceMatchReply * | matchingPlaces(const QPlaceMatchRequest &request) |
| virtual QString | parentCategoryId(const QString &categoryId) const |
| virtual QPlaceIdReply * | removeCategory(const QString &categoryId) |
| virtual QPlaceIdReply * | removePlace(const QString &placeId) |
| virtual QPlaceIdReply * | saveCategory(const QPlaceCategory &category, const QString &parentId) |
| virtual QPlaceIdReply * | savePlace(const QPlace &place) |
| virtual QPlaceSearchReply * | search(const QPlaceSearchRequest &request) |
| virtual QPlaceSearchSuggestionReply * | searchSuggestions(const QPlaceSearchRequest &request) |
| virtual void | setLocales(const QList<QLocale> &locales) |
信号
| void | categoryAdded(const QPlaceCategory &category, const QString &parentId) |
| void | categoryRemoved(const QString &categoryId, const QString &parentId) |
| void | categoryUpdated(const QPlaceCategory &category, const QString &parentId) |
| void | dataChanged() |
| void | errorOccurred(QPlaceReply *reply, QPlaceReply::Error error, const QString &errorString = QString()) |
| void | finished(QPlaceReply *reply) |
| void | placeAdded(const QString &placeId) |
| void | placeRemoved(const QString &placeId) |
| void | placeUpdated(const QString &placeId) |
受保护函数
| QPlaceManager * | manager() const |
详细说明
注意:不保证 后端类的源代码或二进制兼容性。仅保证该 API 可在其开发所基于的 Qt 版本上正常工作。不过,API 变更仅会在次要版本(如 6.6、6.7 等)中进行。
应用程序开发者无需关注 QPlaceManagerEngine。但后端实现者需要从 QPlaceManagerEngine 派生类,并为抽象虚函数提供实现。
有关编写后端的更多信息,请参阅Places 后端文档。
另请参阅 QPlaceManager 。
成员函数文档
[explicit] QPlaceManagerEngine::QPlaceManagerEngine(const QVariantMap ¶meters, QObject *parent = nullptr)
使用指定的parent 创建一个新的引擎,并通过parameters 向引擎传递任何与实现相关的数据。
[virtual noexcept] QPlaceManagerEngine::~QPlaceManagerEngine()
会损坏这台发动机。
[virtual] QPlaceCategory QPlaceManagerEngine::category(const QString &categoryId) const
返回与给定的categoryId 相对应的类别。
[signal] void QPlaceManagerEngine::categoryAdded(const QPlaceCategory &category, const QString &parentId)
当category 被添加到管理器引擎的数据存储中时,会发出此信号。category 的父对象由parentId 指定。
仅支持 QPlaceManager::NotificationsFeature 的管理引擎才会发出此信号。
另请参阅 dataChanged()。
[signal] void QPlaceManagerEngine::categoryRemoved(const QString &categoryId, const QString &parentId)
当与categoryId 对应的类别从管理引擎的数据存储中被移除时,会发出此信号。被移除类别的父类别由parentId 指定。
仅支持 QPlaceManager::NotificationsFeature 的管理引擎才会发出此信号。
另请参阅 dataChanged()。
[signal] void QPlaceManagerEngine::categoryUpdated(const QPlaceCategory &category, const QString &parentId)
如果管理引擎的数据存储中修改了某个category ,则会发出此信号。被修改的类别的父类别由parentId 指定。
仅支持 QPlaceManager::NotificationsFeature 的管理引擎才会发出此信号。
另请参阅 dataChanged()。
[virtual] QList<QPlaceCategory> QPlaceManagerEngine::childCategories(const QString &parentId) const
返回与parentId 对应的类别的子类别列表。如果parentId 为空,则返回所有顶级类别。
[virtual] QStringList QPlaceManagerEngine::childCategoryIds(const QString &categoryId) const
返回与categoryId 对应的类别的子类别标识符。如果categoryId 为空,则返回所有顶级类别的标识符。
[virtual] QPlace QPlaceManagerEngine::compatiblePlace(const QPlace &original) const
返回original 地点的经过精简或修改的版本,该版本适合由管理引擎保存。
修改后的版本中仅包含该管理器支持的地点详细信息。地点 ID 等特定于管理器的数据不会从original 复制过来。
[virtual] QUrl QPlaceManagerEngine::constructIconUrl(const QPlaceIcon &icon, const QSize &size) const
QUrl QPlaceManagerEngine::constructIconUrl(constQPlaceIcon &icon, constQSize &size)
根据给定的icon 和size 构建图标 URL。返回与给定参数最匹配的图标图像的 URL。
[signal] void QPlaceManagerEngine::dataChanged()
*
当引擎底层数据存储发生大规模变更,且引擎认为这些变更足够重大,需要客户端重新加载所有数据时,引擎会发出此信号。
一旦发出该信号,就不会再针对相关更改发出其他信号。
[signal] void QPlaceManagerEngine::errorOccurred(QPlaceReply *reply, QPlaceReply::Error error, const QString &errorString = QString())
当在处理 `reply` 时检测到错误时,将发出此信号。随后可能会发出 `QPlaceManager::finished()` 信号。
该错误将通过错误代码error 进行描述。如果errorString 不为空,则其中将包含面向开发人员(而非最终用户)的错误文本描述。
该信号与QPlaceReply::errorOccurred() 将同时发出。
注意:请 勿在连接到该信号的槽中删除reply 对象。请改用deleteLater()。
[signal] void QPlaceManagerEngine::finished(QPlaceReply *reply)
当reply 处理完成时,会发出此信号。
如果 reply->error() 等于QPlaceReply::NoError ,则表示处理已成功完成。
该信号和QPlaceReply::finished()将同时发出。
注意:请 勿在连接到此信号的槽中删除reply 对象。请改用deleteLater()。
[virtual] QPlaceContentReply *QPlaceManagerEngine::getPlaceContent(const QPlaceContentRequest &request)
根据request 中指定的参数,检索某个地点的相关内容。
[virtual] QPlaceDetailsReply *QPlaceManagerEngine::getPlaceDetails(const QString &placeId)
检索与给定的placeId 相对应的地点详情。
[virtual] QPlaceReply *QPlaceManagerEngine::initializeCategories()
初始化管理引擎的类别。
[virtual] QList<QLocale> QPlaceManagerEngine::locales() const
返回一个首选语言环境列表。这些语言环境将作为提示,告知管理引擎应以何种语言、地区和类别详情进行返回。
如果无法满足第一个指定的区域设置,管理引擎将退而采用下一个,依此类推。
不同提供商对区域设置的支持情况可能有所不同。对于支持该功能的提供商,默认将使用global default locale 。如果管理引擎未被分配任何区域设置,则会隐式使用全局默认区域设置。对于不支持区域设置的引擎,区域设置列表始终为空。
另请参阅 setLocales()。
[protected] QPlaceManager *QPlaceManagerEngine::manager() const
返回用于创建此引擎的管理器实例。
QString QPlaceManagerEngine::managerName() const
返回该引擎实现用于将其与其他插件提供的实现区分开来的名称。
管理器名称会自动设置为与 QGeoServiceProviderFactory::providerName() 返回的名称相同。
int QPlaceManagerEngine::managerVersion() const
返回此引擎实现的版本。
管理器版本会自动设置为与 QGeoServiceProviderFactory::providerVersion() 相同。
[virtual] QPlaceMatchReply *QPlaceManagerEngine::matchingPlaces(const QPlaceMatchRequest &request)
返回一个包含地点列表的响应,这些地点与request 中指定的地点对应/匹配。
[virtual] QString QPlaceManagerEngine::parentCategoryId(const QString &categoryId) const
返回与categoryId 对应的类别的父类别标识符。
[signal] void QPlaceManagerEngine::placeAdded(const QString &placeId)
当某个位置被添加到管理器引擎的数据存储中时,会发出此信号。具体添加的位置由placeId 指定。
仅支持 QPlaceManager::NotificationsFeature 的管理引擎才会发出此信号。
另请参阅 dataChanged()。
[signal] void QPlaceManagerEngine::placeRemoved(const QString &placeId)
如果某个位置已从管理器引擎的数据存储中移除,则会触发此信号。被移除的具体位置由placeId 指定。
仅支持 QPlaceManager::NotificationsFeature 的管理引擎才会发出此信号。
另请参阅 dataChanged()。
[signal] void QPlaceManagerEngine::placeUpdated(const QString &placeId)
如果管理器引擎的数据存储中某个位置已被修改,则会发出此信号。具体被修改的位置由placeId 指定。
仅支持 QPlaceManager::NotificationsFeature 的管理引擎才会发出此信号。
另请参阅 dataChanged()。
[virtual] QPlaceIdReply *QPlaceManagerEngine::removeCategory(const QString &categoryId)
从管理引擎的数据存储中删除与categoryId 对应的分类。
[virtual] QPlaceIdReply *QPlaceManagerEngine::removePlace(const QString &placeId)
从管理引擎的数据存储中删除与placeId 对应的位置。
[virtual] QPlaceIdReply *QPlaceManagerEngine::saveCategory(const QPlaceCategory &category, const QString &parentId)
保存一个category ,该分类是parentId 所指定的分类的子分类。如果parentId 为空,则category 将作为顶级分类保存。
[virtual] QPlaceIdReply *QPlaceManagerEngine::savePlace(const QPlace &place)
将指定的place 保存到管理引擎的数据存储中。
[virtual] QPlaceSearchReply *QPlaceManagerEngine::search(const QPlaceSearchRequest &request)
根据request 中指定的参数搜索地点。
[virtual] QPlaceSearchSuggestionReply *QPlaceManagerEngine::searchSuggestions(const QPlaceSearchRequest &request)
根据request 中指定的参数,请求一组搜索词建议。
[virtual] void QPlaceManagerEngine::setLocales(const QList<QLocale> &locales)
设置首选列表:locales 。
另请参阅 locales()。
© 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.