QPlaceReply Class

The QPlaceReply class manages an operation started by an instance of QPlaceManager and serves as a base class for more specialized replies. More...

Header: #include <QPlaceReply>
qmake: QT += location
Since: Qt 5.6
Inherits: QObject
Inherited By:

QPlaceContentReply, QPlaceDetailsReply, QPlaceIdReply, QPlaceMatchReply, QPlaceSearchReply, and QPlaceSearchSuggestionReply

Public Types

enum Error { NoError, PlaceDoesNotExistError, CategoryDoesNotExistError, CommunicationError, ..., UnknownError }
enum Type { Reply, DetailsReply, SearchReply, SearchSuggestionReply, ..., MatchReply }

Public Functions

QPlaceReply(QObject *parent = nullptr)
virtual ~QPlaceReply()
QPlaceReply::Error error() const
QString errorString() const
bool isFinished() const
virtual QPlaceReply::Type type() const
  • 31 public functions inherited from QObject

Public Slots

virtual void abort()
  • 1 public slot inherited from QObject

Signals

void aborted()
void contentUpdated()
void error(QPlaceReply::Error error, const QString &errorString = QString())
void finished()

Static Public Members

const QMetaObject staticMetaObject
  • 9 static public members inherited from QObject

Protected Functions

void setError(QPlaceReply::Error error, const QString &errorString)
void setFinished(bool finished)
  • 9 protected functions inherited from QObject

Protected Variables

QPlaceReplyPrivate * d_ptr

Additional Inherited Members

  • 1 property inherited from QObject

Detailed Description

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.

See also QPlaceManager.

Member Type Documentation

enum QPlaceReply::Error

Describes an error which occurred during an operation.

Constant Value Description
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.

enum QPlaceReply::Type

Describes the reply's type.

Constant Value Description
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.

Member Function Documentation

QPlaceReply::QPlaceReply(QObject *parent = nullptr)

Constructs a reply object with a given parent.

[virtual] QPlaceReply::~QPlaceReply()

Destroys the reply object.

[virtual slot] void QPlaceReply::abort()

Cancels the operation immediately.

See also aborted().

[signal] void QPlaceReply::aborted()

This signal is emitted when the operation has been cancelled.

This function was introduced in Qt 5.9.

See also abort().

[signal] void QPlaceReply::contentUpdated()

This signal is emitted when this reply has updated content available. Depending on the plugin, this signal may never be emitted or emitted multiple times before QPlaceReply::finished() is emitted, as some backends are able to return the requested content asynchronously and incrementally.

Note: Do not delete or deleteLater this reply object in the slot connected to this signal. Do it only upon QPlaceReply::finished.

QPlaceReply::Error QPlaceReply::error() const

Returns the error code.

See also 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 signal by using the function pointer syntax, Qt provides a convenient helper for obtaining the function pointer as shown in this example:

connect(placeReply, QOverload<QPlaceReply::Error, const QString &>::of(&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.

See also 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.

See also 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.

See also finished().

[virtual] QPlaceReply::Type QPlaceReply::type() const

Returns the type of the reply.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.12/qplacereply.html