QPlaceReply Class

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
开始支持版本: Qt 5.6
基类: QObject
派生类:

QPlaceContentReply, QPlaceDetailsReply, QPlaceIdReply, QPlaceMatchReply, QPlaceSearchReply, and 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
  • 32 个公有函数继承自 QObject

公有槽函数

virtual void abort()
  • 1 个公有槽函数继承自 QObject

信号

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)
  • 9 个受保护的函数继承自 QObject

其他继承的成员

  • 1 个属性继承自 QObject
  • 1 个公有变量继承自 QObject
  • 10 个静态公有成员继承自 QObject
  • 2 个受保护的变量继承自 QObject

详细描述

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() and 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.

成员类型

enum QPlaceReply::Error

Describes an error which occurred during an operation.

ConstantValueDescription
QPlaceReply::NoError0No error has occurred
QPlaceReply::PlaceDoesNotExistError1A specified place could not be found
QPlaceReply::CategoryDoesNotExistError2A specified category could not be found
QPlaceReply::CommunicationError3An error occurred communicating with the service provider.
QPlaceReply::ParseError4The response from the service provider or an import file was in an unrecognizable format
QPlaceReply::PermissionsError5The operation failed because of insufficient permissions.
QPlaceReply::UnsupportedError6The operation was not supported by the service provider.
QPlaceReply::BadArgumentError7. A parameter that was provided was invalid.
QPlaceReply::CancelError8The operation was canceled.
QPlaceReply::UnknownError9An error occurred which does not fit into any of the other categories.

enum QPlaceReply::Type

Describes the reply's type.

ConstantValueDescription
QPlaceReply::Reply0This is a generic reply.
QPlaceReply::DetailsReply1This is a reply for the retrieval of place details
QPlaceReply::SearchReply2This is a reply for the place search operation.
QPlaceReply::SearchSuggestionReply3This is a reply for a search suggestion operation.
QPlaceReply::ContentReply4This is a reply for content associated with a place.
QPlaceReply::IdReply5This is a reply that returns an identifier of a place or category. Typically used for place or category save and remove operations.
QPlaceReply::MatchReply6This is a reply that returns places that match those from another provider.

成员函数

QPlaceReply::QPlaceReply(QObject *parent = Q_NULLPTR)

Constructs a reply object with a given parent.

QPlaceReply::~QPlaceReply()

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.

This function was introduced in Qt 5.9.

参见 abort().

QPlaceReply::Error QPlaceReply::error() const

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. If 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.

Note: Do not delete this reply object in the slot connected to this signal. Use deleteLater() instead.

Note: Signal error is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:


  connect(placeReply, static_cast<void(QPlaceReply::*)(QPlaceReply::Error, const QString &)>(&QPlaceReply::error),
      [=](QPlaceReply::Error error, const QString &errorString){ /* ... */ });

QString QPlaceReply::errorString() const

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.

If error() equals QPlaceReply::NoError then the processing finished successfully.

This signal and QPlaceManager::finished() will be emitted at the same time.

Note: Do not delete this reply object in the slot connected to this signal. Use deleteLater() instead.

参见 setFinished().

bool QPlaceReply::isFinished() const

Return true if the reply has completed.

[protected] void QPlaceReply::setError(QPlaceReply::Error error, const QString &errorString)

Sets the 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() signal to be emitted.

参见 finished().

[virtual] Type QPlaceReply::type() const

Returns the type of the reply.