QPlaceManagerEngine Class

QPlaceManagerEngine 类为希望访问位置功能的QGeoServiceProvider 插件实现者提供了一个接口。更多

Header: #include <QPlaceManagerEngine>
qmake: QT += location
Inherits: QObject

公共函数

QPlaceManagerEngine(const QVariantMap &parameters, 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 Backend文档。

另请参阅 QPlaceManager

成员函数文档

[explicit] QPlaceManagerEngine::QPlaceManagerEngine(const QVariantMap &parameters, 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(const &icon, const &size)QPlaceIcon QSize

从给定的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 保存到管理器引擎的数据存储中。

根据request 中指定的参数搜索地点。

[virtual] QPlaceSearchSuggestionReply *QPlaceManagerEngine::searchSuggestions(const QPlaceSearchRequest &request)

根据request 中指定的参数请求一组搜索词建议。

[virtual] void QPlaceManagerEngine::setLocales(const QList<QLocale> &locales)

设置首选locales 列表。

另请参阅 locales() 。

© 2025 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.