内容表

上一话题

QPlaceSearchReply

下一话题

QPlaceSearchResult

QPlaceSearchRequest

QPlaceSearchRequest class represents the set of parameters for a search request. 更多

Inheritance diagram of PySide2.QtLocation.QPlaceSearchRequest

概要

函数

详细描述

A typical search request may look like the following:

QPlaceSearchRequest searchRequest;
searchRequest.setSearchTerm("Fast food"); //search term for what we are interested in
//set a search center
searchRequest.setSearchArea(QGeoCircle(QGeoCoordinate(2.3, 48.87)));
//set a distance hint as a relevancy hint.
//closer places have greater weighting in the ranking of results.
searchRequest.setRelevanceHint(QPlaceSearchRequest::DistanceHint);
//use limit to adjust pagination.
//this limits the number of place results to 5 per page.
searchRequest.setLimit(5);
//provide some categories to narrow down search
QList<QPlaceCategory> categories;
categories << diner << restaurant;
searchRequest.setCategories(categories);
											

Note that specifying a search center can be done by setting a circular search area that has a center but no radius. The default radius is set to -1, which indicates an undefined radius. The provider will interpret this as being free to choose its own default radius.

QPlaceSearchRequest is primarily used with the QPlaceManager to search for places , however it is also used to provide parameters for generating search term suggestions . Note that in this context only some of the parameters may be relevant. For example, the search area is useful in narrowing down relevant search suggestions, while other parameters such as relevance hint are not so applicable.

Also be aware that providers may vary by which parameters they support for example some providers may not support paging while others do, some providers may honor relevance hints while others may completely ignore them, see the plugin documentation 了解更多细节。

class QPlaceSearchRequest

QPlaceSearchRequest(other)

param other

QPlaceSearchRequest

Default constructor. Constructs an new request object.

构造副本为 other .

PySide2.QtLocation.QPlaceSearchRequest. RelevanceHint

Defines hints to help rank place results.

常量

描述

QPlaceSearchRequest.UnspecifiedHint

No explicit hint has been specified.

QPlaceSearchRequest.DistanceHint

Distance to a search center is relevant for the user. Closer places are more highly weighted. This hint is only useful if a circular search area is used in the query.

QPlaceSearchRequest.LexicalPlaceNameHint

Alphabetic ordering of places according to name is relevant to the user.

PySide2.QtLocation.QPlaceSearchRequest. categories ( )
返回类型

Return the categories to be used in the search request. Places need only to belong to one of the categories to be considered a match by the request.

另请参阅

setCategories()

PySide2.QtLocation.QPlaceSearchRequest. clear ( )

Clears the search request.

PySide2.QtLocation.QPlaceSearchRequest. limit ( )
返回类型

int

Returns the maximum number of search results 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 results to return. The default limit is -1.

另请参阅

setLimit()

PySide2.QtLocation.QPlaceSearchRequest. __ne__ ( other )
参数

other QPlaceSearchRequest

返回类型

bool

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

PySide2.QtLocation.QPlaceSearchRequest. __eq__ ( other )
参数

other QPlaceSearchRequest

返回类型

bool

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

PySide2.QtLocation.QPlaceSearchRequest. recommendationId ( )
返回类型

unicode

Returns the place id which will be used to search for recommendations for similar places.

PySide2.QtLocation.QPlaceSearchRequest. relevanceHint ( )
返回类型

RelevanceHint

Returns the relevance hint of the request. The hint is given to the provider to help but not dictate the ranking of results. For example providing a distance hint may give closer places a higher ranking but it doesn’t necessarily mean that he results will be ordered strictly according to distance.

PySide2.QtLocation.QPlaceSearchRequest. searchArea ( )
返回类型

QGeoShape

Returns the search area which will be used to limit search results. The default search area is an invalid QGeoShape , indicating that no specific search area is defined.

另请参阅

setSearchArea()

PySide2.QtLocation.QPlaceSearchRequest. searchContext ( )
返回类型

object

Returns backend specific additional search context associated with this place search request. The search context is typically set as part of a proposed search 结果 .

PySide2.QtLocation.QPlaceSearchRequest. searchTerm ( )
返回类型

unicode

Returns the search term.

另请参阅

setSearchTerm()

PySide2.QtLocation.QPlaceSearchRequest. setCategories ( categories )
参数

categories

Sets the search request to search from the list of given categories . Any places returned during the search will match at least one of the categories .

PySide2.QtLocation.QPlaceSearchRequest. setCategory ( category )
参数

category QPlaceCategory

Sets the search request to search by a single category

另请参阅

setCategories()

PySide2.QtLocation.QPlaceSearchRequest. setLimit ( limit )
参数

limit int

Set the maximum number of search results to retrieve to limit .

另请参阅

limit()

PySide2.QtLocation.QPlaceSearchRequest. setRecommendationId ( recommendationId )
参数

recommendationId – unicode

设置 placeId which will be used to search for recommendations.

PySide2.QtLocation.QPlaceSearchRequest. setRelevanceHint ( hint )
参数

hint RelevanceHint

Sets the relevance hint to be used when searching for a place.

另请参阅

relevanceHint()

PySide2.QtLocation.QPlaceSearchRequest. setSearchArea ( area )
参数

area QGeoShape

Sets the search request to search within the given area .

另请参阅

searchArea()

PySide2.QtLocation.QPlaceSearchRequest. setSearchContext ( context )
参数

context – object

Sets the search context to context .

注意

This method is intended to be used by geo service plugins when returning search results of type ProposedSearchResult .

The search context is used by backends to store additional search context related to the search request. Other relevant fields should also be filled in. For example, if the search context encodes a text search the search term should also be set with setSearchTerm() . The search context allows additional search context to be kept which is not directly accessible via the Qt Location API.

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

另请参阅

searchContext()

PySide2.QtLocation.QPlaceSearchRequest. setSearchTerm ( term )
参数

term – unicode

Sets the search term .

另请参阅

searchTerm()