QPlaceReply Class
QPlaceReply 类管理由QPlaceManager 实例启动的操作,并充当更专业回复的基类。更多
Header: | #include <QPlaceReply> |
qmake: | QT += location |
Inherits: | QObject |
Inherited By: | QPlaceContentReply, QPlaceDetailsReply, QPlaceIdReply, QPlaceMatchReply, QPlaceSearchReply, and QPlaceSearchSuggestionReply |
公共类型
enum | Error { NoError, PlaceDoesNotExistError, CategoryDoesNotExistError, CommunicationError, ParseError, …, UnknownError } |
enum | Type { Reply, DetailsReply, SearchReply, SearchSuggestionReply, ContentReply, …, MatchReply } |
公共函数
QPlaceReply(QObject *parent = nullptr) | |
virtual | ~QPlaceReply() |
QPlaceReply::Error | error() const |
QString | errorString() const |
bool | isFinished() const |
virtual QPlaceReply::Type | type() const |
公共插槽
virtual void | abort() |
信号
void | aborted() |
void | contentUpdated() |
void | errorOccurred(QPlaceReply::Error error, const QString &errorString = QString()) |
void | finished() |
受保护函数
void | setError(QPlaceReply::Error error, const QString &errorString) |
void | setFinished(bool finished) |
详细说明
QPlaceReply 及其每个专门子类管理其相应操作的状态和结果。QPlaceReply 本身用于没有结果的操作,即只需知道操作成功或失败。
finished() 信号可用于监控操作的进度。操作完成后,error() 和errorString() 方法会提供操作是否成功完成的信息。如果操作成功,回复将包含该操作的结果,也就是说,每个子类都有适当的函数来检索操作结果。
另请参阅 QPlaceManager 。
成员类型文档
enum QPlaceReply::Error
描述操作过程中发生的错误。
常量 | 值 | 说明 |
---|---|---|
QPlaceReply::NoError | 0 | 未发生错误 |
QPlaceReply::PlaceDoesNotExistError | 1 | 找不到指定地点 |
QPlaceReply::CategoryDoesNotExistError | 2 | 找不到指定类别 |
QPlaceReply::CommunicationError | 3 | 与服务提供商通信时发生错误。 |
QPlaceReply::ParseError | 4 | 服务提供商的响应或导入文件的格式无法识别 |
QPlaceReply::PermissionsError | 5 | 由于权限不足,操作失败。 |
QPlaceReply::UnsupportedError | 6 | 服务提供商不支持该操作。 |
QPlaceReply::BadArgumentError | 7 | .提供的参数无效。 |
QPlaceReply::CancelError | 8 | 操作被取消。 |
QPlaceReply::UnknownError | 9 | 发生了不属于任何其他类别的错误。 |
enum QPlaceReply::Type
描述回复的类型。
常数 | 值 | 说明 |
---|---|---|
QPlaceReply::Reply | 0 | 这是一个通用回复。 |
QPlaceReply::DetailsReply | 1 | 检索地点详细信息的回复 |
QPlaceReply::SearchReply | 2 | 这是地方搜索操作的回复。 |
QPlaceReply::SearchSuggestionReply | 3 | 这是搜索建议操作的回复。 |
QPlaceReply::ContentReply | 4 | 与地点相关内容的回复。 |
QPlaceReply::IdReply | 5 | 返回地点或类别标识符的回复。通常用于地点或类别的保存和删除操作。 |
QPlaceReply::MatchReply | 6 | 返回与其他提供商的地点相匹配的回复。 |
成员函数文档
[explicit]
QPlaceReply::QPlaceReply(QObject *parent = nullptr)
用给定的parent 构建回复对象。
[virtual noexcept]
QPlaceReply::~QPlaceReply()
销毁回复对象。
[virtual slot]
void QPlaceReply::abort()
立即取消操作。
另请参阅 aborted().
[signal]
void QPlaceReply::aborted()
该信号在操作取消时发出。
另请参阅 abort().
[signal]
void QPlaceReply::contentUpdated()
当该回复有更新内容可用时,就会发出该信号。根据插件的不同,该信号可能永远不会发出或在QPlaceReply::finished() 发出前多次发出,因为某些后端可以异步和增量方式返回请求的内容。
注意: 请勿在连接到此信号的槽中删除或稍后删除此回复对象。只有在QPlaceReply::finished 时才这样做。
QPlaceReply::Error QPlaceReply::error() const
返回错误代码。
另请参见 setError()。
[signal]
void QPlaceReply::errorOccurred(QPlaceReply::Error error, const QString &errorString = QString())
当在处理该回复时检测到错误,就会发出该信号。随后可能会发出finished() 信号。
错误代码error 将描述该错误。如果errorString 不为空,则将包含针对开发人员而非最终用户的错误文字说明。
该信号和QPlaceManager::errorOccurred() 将同时发出。
注意: 请勿在与此信号相连的槽中删除此回复对象。请使用deleteLater() 代替。
QString QPlaceReply::errorString() const
返回回复的错误字符串。错误字符串仅供开发人员使用,不适合显示给最终用户。
如果没有发生错误,则字符串为空。
[signal]
void QPlaceReply::finished()
该回复处理完毕后会发出该信号。
如果error() 等于QPlaceReply::NoError ,则表示处理已成功完成。
此信号和QPlaceManager::finished() 将同时发出。
注意: 请勿在与此信号相连的槽中删除此回复对象。请使用deleteLater() 代替。
另请参见 setFinished()。
bool QPlaceReply::isFinished() const
如果回复已完成,则返回 true。
[protected]
void QPlaceReply::setError(QPlaceReply::Error error, const QString &errorString)
设置回复的error 和errorString 。此函数不会发出QPlaceReply::errorOccurred(QPlaceReply::Error, constQString &errorString) 信号。
另请参阅 error() 。
[protected]
void QPlaceReply::setFinished(bool finished)
设置回复是否为finished 的状态。此函数不会导致发出finished() 信号。
另请参阅 finished() 。
[virtual]
QPlaceReply::Type QPlaceReply::type() const
返回回复的类型。
© 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.