QPlaceContentRequest Class

The QPlaceContentRequest class represents the parameters of a content request. 更多...

头: #include <QPlaceContentRequest>
qmake: QT += location
Since: Qt 5.6

公共函数

QPlaceContentRequest ()
QPlaceContentRequest (const QPlaceContentRequest & other )
~QPlaceContentRequest ()
void clear ()
QVariant contentContext () const
QPlaceContent::Type contentType () const
int limit () const
QString placeId () const
void setContentContext (const QVariant & context )
void setContentType (QPlaceContent::Type type )
void setLimit (int limit )
void setPlaceId (const QString & 标识符 )
bool operator!= (const QPlaceContentRequest & other ) const
QPlaceContentRequest & operator= (const QPlaceContentRequest & other )
bool operator== (const QPlaceContentRequest & other ) const

详细描述

The QPlaceContentRequest class represents the parameters of a content request.

The QPlaceContentRequest class is used in conjunction with a QPlaceManager to retrieve rich content like images and reviews in a paginated fashion. The following code would request a set of 5 images from the 10th index:

QPlaceContentRequest request;
request.setContentType(QPlaceContent::ImageType);
request.setPlaceId(place.placeId());
request.setLimit(5);
QPlaceContentReply *contentReply = manager->getPlaceContent(request);
//..connect signals..//
    ...
    ...
void contentHandler() {
    if (contentReply->error() == QPlaceReply::NoError)  {
        place.insertContent(contentReply->request().contentType(),
                            contentReply->content());
    }
}
					

另请参阅 QPlaceContentReply .

成员函数文档编制

QPlaceContentRequest:: QPlaceContentRequest ()

Constructs a new request object.

QPlaceContentRequest:: QPlaceContentRequest (const QPlaceContentRequest & other )

构造副本为 other .

QPlaceContentRequest:: ~QPlaceContentRequest ()

Destroys the request object

void QPlaceContentRequest:: clear ()

Clears the content request.

QVariant QPlaceContentRequest:: contentContext () const

Returns backend specific additional content context associated with this place content request.

另请参阅 setContentContext ().

QPlaceContent::Type QPlaceContentRequest:: contentType () const

Returns the type of content to be requested, for example reviews or images

另请参阅 setContentType ().

int QPlaceContentRequest:: limit () const

Returns the maximum number of content items to retrieve.

A negative value for limit means that it is undefined. It is left up to the backend provider to choose an appropriate number of items to return.

The default limit is -1.

另请参阅 setLimit ().

QString QPlaceContentRequest:: placeId () const

Returns the identifier of the place content is to be fetched for.

另请参阅 setPlaceId ().

void QPlaceContentRequest:: setContentContext (const QVariant & context )

Sets the content context to context .

注意: This method is intended to be used by geo service plugins when returning place content results.

The content context is used by backends to store additional content context related to the content request. Other relevant fields should also be filled in. For example, if the content request is for image content the content type should also be set with setContentType (). The content context allows additional context to be kept which is not directly accessible via the Qt Location API.

The content context can be of any type storable in a QVariant . The value of the content context is not intended to be used directly by applications.

另请参阅 contentContext ().

void QPlaceContentRequest:: setContentType ( QPlaceContent::Type type )

设置 type of content to be requested.

另请参阅 contentType ().

void QPlaceContentRequest:: setLimit ( int limit )

Set the maximum number of content items to retrieve to limit .

另请参阅 limit ().

void QPlaceContentRequest:: setPlaceId (const QString & 标识符 )

Sets the identifier of the place to fetch content for to 标识符 .

另请参阅 placeId ().

bool QPlaceContentRequest:: operator!= (const QPlaceContentRequest & other ) const

返回 true 若 other is not equal to this content request, otherwise returns false.

QPlaceContentRequest &QPlaceContentRequest:: operator= (const QPlaceContentRequest & other )

赋值 other to this content request and returns a reference to this content request.

bool QPlaceContentRequest:: operator== (const QPlaceContentRequest & other ) const

返回 true 若 other is equal to this content request, otherwise returns false.