The QPlaceReply class manages an operation started by an instance of QPlaceManager and serves as a base class for more specialized replies. 更多...
头: | #include <QPlaceReply> |
qmake: | QT += location |
Since: | Qt 5.6 |
继承: | QObject |
继承者: | QPlaceContentReply , QPlaceDetailsReply , QPlaceIdReply , QPlaceMatchReply , QPlaceSearchReply ,和 QPlaceSearchSuggestionReply |
enum | Error { NoError, PlaceDoesNotExistError, CategoryDoesNotExistError, CommunicationError, ..., UnknownError } |
enum | Type { Reply, DetailsReply, SearchReply, SearchSuggestionReply, ..., MatchReply } |
QPlaceReply (QObject * parent = Q_NULLPTR) | |
~QPlaceReply () | |
QPlaceReply::Error | error () const |
QString | errorString () const |
bool | isFinished () const |
virtual Type | type () const |
virtual void | abort () |
void | aborted () |
void | error (QPlaceReply::Error error , const QString & errorString = QString()) |
void | finished () |
void | setError (QPlaceReply::Error error , const QString & errorString ) |
void | setFinished (bool finished ) |
The QPlaceReply class manages an operation started by an instance of QPlaceManager and serves as a base class for more specialized replies.
The QPlaceReply and each of its specialized subclasses manage the state and results of their corresponding operations. The QPlaceReply itself is used for operations that have no results, that is, it only necessary to know if the operation succeeded or failed.
The finished () signal can be used to monitor the progress of an operation. Once an operation is complete, the error () 和 errorString () methods provide information on whether the operation completed successfully. If successful, the reply will contain the results for that operation, that is, each subclass will have appropriate functions to retrieve the results of an operation.
另请参阅 QPlaceManager .
Describes an error which occurred during an operation.
常量 | 值 | 描述 |
---|---|---|
QPlaceReply::NoError
|
0
|
No error has occurred |
QPlaceReply::PlaceDoesNotExistError
|
1
|
A specified place could not be found |
QPlaceReply::CategoryDoesNotExistError
|
2
|
A specified category could not be found |
QPlaceReply::CommunicationError
|
3
|
An error occurred communicating with the service provider. |
QPlaceReply::ParseError
|
4
|
The response from the service provider or an import file was in an unrecognizable format |
QPlaceReply::PermissionsError
|
5
|
The operation failed because of insufficient permissions. |
QPlaceReply::UnsupportedError
|
6
|
The operation was not supported by the service provider. |
QPlaceReply::BadArgumentError
|
7
|
. A parameter that was provided was invalid. |
QPlaceReply::CancelError
|
8
|
The operation was canceled. |
QPlaceReply::UnknownError
|
9
|
An error occurred which does not fit into any of the other categories. |
Describes the reply's type.
常量 | 值 | 描述 |
---|---|---|
QPlaceReply::Reply
|
0
|
This is a generic reply. |
QPlaceReply::DetailsReply
|
1
|
This is a reply for the retrieval of place details |
QPlaceReply::SearchReply
|
2
|
This is a reply for the place search operation. |
QPlaceReply::SearchSuggestionReply
|
3
|
This is a reply for a search suggestion operation. |
QPlaceReply::ContentReply
|
4
|
This is a reply for content associated with a place. |
QPlaceReply::IdReply
|
5
|
This is a reply that returns an identifier of a place or category. Typically used for place or category save and remove operations. |
QPlaceReply::MatchReply
|
6
|
This is a reply that returns places that match those from another provider. |
Constructs a reply object with a given parent .
Destroys the reply object.
[virtual slot]
void
QPlaceReply::
abort
()
Cancels the operation immediately.
另请参阅 aborted ().
[signal]
void
QPlaceReply::
aborted
()
This signal is emitted when the operation has been cancelled.
该函数在 Qt 5.9 引入。
另请参阅 abort ().
Returns the error code.
另请参阅 setError ().
[signal]
void
QPlaceReply::
error
(
QPlaceReply::Error
error
, const
QString
&
errorString
= QString())
This signal is emitted when an error has been detected in the processing of this reply. The finished () signal will probably follow.
The error will be described by the error code error 。若 errorString is not empty it will contain a textual description of the error meant for developers and not end users.
This signal and QPlaceManager::error () will be emitted at the same time.
注意: Do not delete this reply object in the slot connected to this signal. Use deleteLater () 代替。
注意: 信号 error 在此类中是重载。要使用函数指针句法连接到此信号,必须在静态铸造中指定信号类型,如此范例所示:
connect(placeReply, static_cast<void(QPlaceReply::*)(QPlaceReply::Error, const QString &)>(&QPlaceReply::error), [=](QPlaceReply::Error error, const QString &errorString){ /* ... */ });
Returns the error string of the reply. The error string is intended to be used by developers only and is not fit to be displayed to an end user.
If no error has occurred, the string is empty.
[signal]
void
QPlaceReply::
finished
()
This signal is emitted when this reply has finished processing.
若 error () 等于 QPlaceReply::NoError then the processing finished successfully.
This signal and QPlaceManager::finished () will be emitted at the same time.
注意: Do not delete this reply object in the slot connected to this signal. Use deleteLater () 代替。
另请参阅 setFinished ().
Return true if the reply has completed.
[protected]
void
QPlaceReply::
setError
(
QPlaceReply::Error
error
, const
QString
&
errorString
)
设置 error and errorString of the reply. This function does not cause the QPlaceReply::error ( QPlaceReply::Error , const QString & errorString ) signal to be emitted.
另请参阅 error ().
[protected]
void
QPlaceReply::
setFinished
(
bool
finished
)
Sets the status of whether the reply is finished or not. This function does not cause the finished () 信号被发射。
另请参阅 finished ().
[虚拟]
Type
QPlaceReply::
type
() const
Returns the type of the reply.