PySide6.QtLocation.QPlaceManager¶
- class QPlaceManager¶
- The - QPlaceManagerclass provides the interface which allows clients to access places stored in a particular backend. More…- Synopsis¶- Methods¶- def - category()
- def - locales()
- def - managerName()
- def - managerVersion()
- def - matchingPlaces()
- def - removeCategory()
- def - removePlace()
- def - saveCategory()
- def - savePlace()
- def - search()
- def - setLocale()
- def - setLocales()
 - Signals¶- def - categoryAdded()
- def - dataChanged()
- def - errorOccurred()
- def - finished()
- def - placeAdded()
- def - placeRemoved()
- def - placeUpdated()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- Warning - This section contains snippets that were automatically translated from C++ to Python and may contain errors. - The following table gives an overview of the functionality provided by the - QPlaceManager- Functionality - Description - Searching for places - Using set of parameters such as a search term and search area, relevant places can be returned to the user. - Categories - Places can be classified as belonging to different categories. The manager supports access to these categories. - Search term suggestions - Given a partially complete search term, a list of potential search terms can be given. - Recommendations - Given an existing place, a set of similar recommended places can be suggested to the user. - Rich Content - Rich content such as images, reviews etc can be retrieved in a paged fashion. - Place or Category management - Places and categories may be saved and removed. It is possible for notifications to be given when this happens. - Localization - Different locales may be specified to return place data in different languages. - Obtaining a QPlaceManager Instance¶- Creation of a - QPlaceManageris facilitated by the- QGeoServiceProvider. See Initializing a manager for an example on how to create a manager.- Asynchronous Interface¶- The - QPlaceManagerclass provides an abstraction of the datastore which contains place information. The functions provided by the- QPlaceManagerand primarily asynchronous and follow a request-reply model. Typically a request is given to the manager, consisting of a various set of parameters and a reply object is created. The reply object has a signal to notify when the request is done, and once completed, the reply contains the results of the request, along with any errors that occurred, if any.- An asynchronous request is generally handled as follows: - #1) Make an appropriate request searchRequest = QPlaceSearchRequest() searchRequest.setSearchTerm("ice cream") searchRequest.setSearchArea(QGeoCircle(QGeoCoordinate(12.34, 56.78))) #2) Use the manager to initiate a request and retrieve a reply object QPlaceSearchReply * searchReply = manager.search(searchRequest) #3) Connect the reply object to a slot which is invoked upon operation completion searchReply.finished.connect( self.processSearchReply) ... ... <Code snippet "places/requesthandler.h:Simple search handler" not found> - See Common Operations for a list of examples demonstrating how the QPlaceManger is used. - Category Initialization¶- Sometime during startup of an application, the - initializeCategories()function should be called to setup the categories. Initializing the categories enables the usage of the following functions:- If the categories need to be refreshed or reloaded, the - initializeCategories()function may be called again.- category(categoryId)¶
- Parameters:
- categoryId – str 
- Return type:
 
 - Returns the category corresponding to the given - categoryId.- categoryAdded(category, parentId)¶
- Parameters:
- category – - QPlaceCategory
- parentId – str 
 
 
 - This signal is emitted if a - categoryhas been added to the manager’s datastore. The parent of the- categoryis specified by- parentId.- This signal is only emitted by managers that support the QPlaceManager::NotificationsFeature. - See also - categoryRemoved(categoryId, parentId)¶
- Parameters:
- categoryId – str 
- parentId – str 
 
 
 - This signal is emitted when the category corresponding to - categoryIdhas been removed from the manager’s datastore. The parent of the removed category is specified by- parentId.- This signal is only emitted by managers that support the QPlaceManager::NotificationsFeature. - See also - categoryUpdated(category, parentId)¶
- Parameters:
- category – - QPlaceCategory
- parentId – str 
 
 
 - This signal is emitted if a - categoryhas been modified in the manager’s datastore. The parent of the modified category is specified by- parentId.- This signal is only emitted by managers that support the QPlaceManager::NotificationsFeature. - See also - childCategories([parentId=""])¶
- Parameters:
- parentId – str 
- Return type:
- .list of QPlaceCategory 
 
 - Returns a list of categories that are children of the category corresponding to - parentId. If- parentIdis empty, all the top level categories are returned.- childCategoryIds([parentId=""])¶
- Parameters:
- parentId – str 
- Return type:
- list of strings 
 
 - Returns the child category identifiers of the category corresponding to - parentId. If- parentIdis empty then all top level category identifiers are returned.- Returns a pruned or modified version of the - originalplace which is suitable to be saved into this manager.- Only place details that are supported by this manager is present in the modified version. Manager specific data such as the place id, is not copied over from the - original.- dataChanged()¶
 - This signal is emitted by the manager if there are large scale changes to its underlying datastore and the manager considers these changes radical enough to require clients to reload all data. - If the signal is emitted, no other signals will be emitted for the associated changes. - This signal is only emitted by managers that support the QPlaceManager::NotificationsFeature. - errorOccurred(reply, error[, errorString=""])¶
- Parameters:
- reply – - QPlaceReply
- error – - Error
- errorString – str 
 
 
 - This signal is emitted when an error has been detected in the processing of - reply. The- finished()signal will probably follow.- The error will be described by the error code - error. If- errorStringis not empty it will contain a textual description of the error meant for developers and not end users.- This signal and - errorOccurred()will be emitted at the same time.- Note - Do not delete the - replyobject in the slot connected to this signal. Use deleteLater() instead.- finished(reply)¶
- Parameters:
- reply – - QPlaceReply
 
 - This signal is emitted when - replyhas finished processing.- If reply->error() equals - NoErrorthen the processing finished successfully.- This signal and - finished()will be emitted at the same time.- Note - Do not delete the - replyobject in the slot connected to this signal. Use deleteLater() instead.- getPlaceContent(request)¶
- Parameters:
- request – - QPlaceContentRequest
- Return type:
 
 - Retrieves content for a place according to the parameters specified in - request.- See Fetching Rich Content for an example of usage. - getPlaceDetails(placeId)¶
- Parameters:
- placeId – str 
- Return type:
 
 - Retrieves a details of place corresponding to the given - placeId.- See Fetching Place Details for an example of usage. - initializeCategories()¶
- Return type:
 
 - Initializes the categories of the manager. - See Using Categories for an example of usage. - Returns a list of preferred locales. The locales are used as a hint to the manager for what language place and category details should be returned in. - If the first specified locale cannot be accommodated, the manager falls back to the next and so forth. Some manager backends may not support a set of locales which are rigidly defined. An arbitrary example is that some places in France could have French and English localizations, while certain areas in America may only have the English localization available. In this example, the set of supported locales is context dependent on the search location. - If the manager cannot accommodate any of the preferred locales, the manager falls back to using a supported language that is backend specific. - Support for locales may vary from provider to provider. For those that do support it, by default, the global default locale is set as the manager’s only locale. - For managers that do not support locales, the locale list is always empty. - See also - managerName()¶
- Return type:
- str 
 
 - Returns the name of the manager - managerVersion()¶
- Return type:
- int 
 
 - Returns the manager version. - matchingPlaces(request)¶
- Parameters:
- request – - QPlaceMatchRequest
- Return type:
 
 - Returns a reply which contains a list of places which correspond/match those specified in the - request. The places specified in the request come from a different manager.- parentCategoryId(categoryId)¶
- Parameters:
- categoryId – str 
- Return type:
- str 
 
 - Returns the parent category identifier of the category corresponding to - categoryId.- placeAdded(placeId)¶
- Parameters:
- placeId – str 
 
 - This signal is emitted if a place has been added to the manager engine’s datastore. The particular added place is specified by - placeId.- This signal is only emitted by managers that support the QPlaceManager::NotificationsFeature. - See also - placeRemoved(placeId)¶
- Parameters:
- placeId – str 
 
 - This signal is emitted if a place has been removed from the manager’s datastore. The particular place that has been removed is specified by - placeId.- This signal is only emitted by managers that support the QPlaceManager::NotificationsFeature. - See also - placeUpdated(placeId)¶
- Parameters:
- placeId – str 
 
 - This signal is emitted if a place has been modified in the manager’s datastore. The particular modified place is specified by - placeId.- This signal is only emitted by managers that support the QPlaceManager::NotificationsFeature. - See also - removeCategory(categoryId)¶
- Parameters:
- categoryId – str 
- Return type:
 
 - Removes the category corresponding to - categoryIdfrom the manager.- See Removing a category for an example of usage. - removePlace(placeId)¶
- Parameters:
- placeId – str 
- Return type:
 
 - Removes the place corresponding to - placeIdfrom the manager.- See Removing a place cpp for an example of usage. - saveCategory(category[, parentId=""])¶
- Parameters:
- category – - QPlaceCategory
- parentId – str 
 
- Return type:
 
 - Saves a - categorythat is a child of the category specified by- parentId. An empty- parentIdmeans- categoryis saved as a top level category.- See Saving a category for an example of usage. - Saves a specified - place.- See Saving a place cpp for an example of usage. - search(query)¶
- Parameters:
- query – - QPlaceSearchRequest
- Return type:
 
 - Searches for places according to the parameters specified in - request.- See Discovery/Search for an example of usage. - searchSuggestions(request)¶
- Parameters:
- request – - QPlaceSearchRequest
- Return type:
 
 - Requests a set of search term suggestions according to the parameters specified in - request. The- requestcan hold the incomplete search term, along with other data such as a search area to narrow down relevant results.- See Search Suggestions for an example of usage. - Convenience function which sets the manager’s list of preferred locales to a single - locale.- setLocales(locale)¶
- Parameters:
- locale – .list of QLocale 
 
 - Set the list of preferred - locales.- See also