Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QPlaceSearchRequest Class

The QPlaceSearchRequest class represents the set of parameters for a search request. More...

 #include <QPlaceSearchRequest>

This class was introduced in Qt Location 5.0.

Public Types

enum RelevanceHint { UnspecifiedHint, DistanceHint, LexicalPlaceNameHint }

Public Functions

QPlaceSearchRequest()
QPlaceSearchRequest(const QPlaceSearchRequest & other)
~QPlaceSearchRequest()
QList<QPlaceCategory> categories() const
void clear()
int limit() const
int maximumCorrections() const
int offset() const
RelevanceHint relevanceHint() const
QGeoBoundingArea searchArea() const
QString searchTerm() const
void setCategories(const QList<QPlaceCategory> & categories)
void setCategory(const QPlaceCategory & category)
void setLimit(int limit)
void setMaximumCorrections(int number)
void setOffset(int offset)
void setRelevanceHint(RelevanceHint hint)
void setSearchArea(const QGeoBoundingArea & area)
void setSearchTerm(const QString & term)
void setVisibilityScope(QtLocation::VisibilityScope scope)
QtLocation::VisibilityScope visibilityScope() const
bool operator!=(const QPlaceSearchRequest & other) const
QPlaceSearchRequest & operator=(const QPlaceSearchRequest & other)
bool operator==(const QPlaceSearchRequest & other) const

Detailed Description

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

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(QGeoBoundingCircle(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 offset and limit to provide pagination.
 //this retrieves the next 5 items from the 10th index
 searchRequest.setOffset(9);
 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.

The QPlaceSearchRequest will assume ownership of the bounding area and will be responsible for its destruction.

The QPlaceSearchRequest is primarily used with the QPlaceManager to search for places, however it is also used to provide parameters for generating search term suggestions and retreiving recommendations. Note that depending on usage, some parameters may not be relevant, for example the relevance hint is not important for search term suggestions. However in general, most of the parameters are useful for each of these operations, for example for a recommendation, a search area and categories can be useful in narrowing down recommendation candidates.

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 Information about plugins.

Member Type Documentation

enum QPlaceSearchRequest::RelevanceHint

Defines hints to help rank place results.

ConstantValueDescription
QPlaceSearchRequest::UnspecifiedHint0No explicit hint has been specified.
QPlaceSearchRequest::DistanceHint1Distance to a search center is relevant for the user. Closer places are more highly weighted. This hint is only useful if a circular bounding area is used in the query.
QPlaceSearchRequest::LexicalPlaceNameHint2Alphabetic ordering of places according to name is relevant to the user.

Member Function Documentation

QPlaceSearchRequest::QPlaceSearchRequest()

Default constructor. Constructs an new request object.

QPlaceSearchRequest::QPlaceSearchRequest(const QPlaceSearchRequest & other)

Constructs a copy of other.

QPlaceSearchRequest::~QPlaceSearchRequest()

Destroys the request object.

QList<QPlaceCategory> QPlaceSearchRequest::categories() const

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.

See also setCategories().

void QPlaceSearchRequest::clear()

Clears the search request.

int QPlaceSearchRequest::limit() const

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.

See also setLimit().

int QPlaceSearchRequest::maximumCorrections() const

Returns the maximum number of search term corrections that may be returned.

See also setMaximumCorrections().

int QPlaceSearchRequest::offset() const

Returns the offset index of the first item that is to be retrieved.

The default offset is 0.

See also setOffset().

RelevanceHint QPlaceSearchRequest::relevanceHint() const

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.

See also setRelevanceHint().

QGeoBoundingArea QPlaceSearchRequest::searchArea() const

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

See also setSearchArea().

QString QPlaceSearchRequest::searchTerm() const

Returns the search term.

See also setSearchTerm().

void QPlaceSearchRequest::setCategories(const QList<QPlaceCategory> & 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.

See also categories() and setCategory().

void QPlaceSearchRequest::setCategory(const QPlaceCategory & category)

Sets the search request to search by a single category

See also setCategories().

void QPlaceSearchRequest::setLimit(int limit)

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

See also limit().

void QPlaceSearchRequest::setMaximumCorrections(int number)

Sets maximum number of search term corrections that may be returned.

See also maximumCorrections().

void QPlaceSearchRequest::setOffset(int offset)

Sets the starting index of the first item to be retrieved to offset.

See also offset().

void QPlaceSearchRequest::setRelevanceHint(RelevanceHint hint)

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

See also relevanceHint().

void QPlaceSearchRequest::setSearchArea(const QGeoBoundingArea & area)

Sets the search request to search within the given area.

See also searchArea().

void QPlaceSearchRequest::setSearchTerm(const QString & term)

Sets the search term.

See also searchTerm().

void QPlaceSearchRequest::setVisibilityScope(QtLocation::VisibilityScope scope)

Sets the visibility scope used when searching for places.

See also visibilityScope().

QtLocation::VisibilityScope QPlaceSearchRequest::visibilityScope() const

Returns the visibility scope used when searching for places. The default value is QtLocation::UnspecifiedVisibility meaning that no explicit scope has been assigned. Places of any scope may be returned during the search.

See also setVisibilityScope().

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

Returns true if other is not equal to this search request, otherwise returns false.

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

Assigns other to this search request and returns a reference to this search request.

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

Returns true if other is equal to this search request, otherwise returns false.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web