SearchViewController Class

SearchView."> SearchViewController Class | ArcGISQtToolkit 200.0
  • SearchViewController
  • class Esri::ArcGISRuntime::Toolkit::SearchViewController

    Performs searches and manages search state for a SearchView. More...

    Header: #include <SearchViewController>
    Inherits: QObject

    Public Types

    enum class SearchResultMode { Single, Multiple, Automatic }

    Properties

    Public Functions

    SearchViewController(QObject *parent = nullptr)
    virtual ~SearchViewController() override
    void acceptSuggestion(Esri::ArcGISRuntime::Toolkit::SearchSuggestion *searchSuggestion)
    Esri::ArcGISRuntime::Toolkit::SearchSourceInterface *activeSource() const
    void clearSearch()
    void commitSearch(bool restrictToArea)
    QString currentQuery() const
    QString defaultPlaceholder() const
    QObject *geoView() const
    bool isAutomaticConfigurationEnabled() const
    bool isEligableForRequery() const
    Esri::ArcGISRuntime::Geometry queryArea() const
    Esri::ArcGISRuntime::Point queryCenter() const
    Esri::ArcGISRuntime::Toolkit::SearchViewController::SearchResultMode resultMode() const
    Esri::ArcGISRuntime::Toolkit::GenericListModel *results() const
    Esri::ArcGISRuntime::Toolkit::SearchResult *selectedResult() const
    void setActiveSource(Esri::ArcGISRuntime::Toolkit::SearchSourceInterface *activeSource)
    void setCurrentQuery(QString currentQuery)
    void setDefaultPlaceholder(QString defaultPlaceholder)
    void setGeoView(QObject *geoView)
    void setIsAutomaticConfigurationEnabled(bool isAutomaticConfigurationEnabled)
    void setIsEligableForRequery(bool isEligableForRequery)
    void setQueryArea(Esri::ArcGISRuntime::Geometry queryArea)
    void setQueryCenter(Esri::ArcGISRuntime::Point queryCenter)
    void setResultMode(Esri::ArcGISRuntime::Toolkit::SearchViewController::SearchResultMode resultMode)
    void setSelectedResult(Esri::ArcGISRuntime::Toolkit::SearchResult *selectedResult)
    void setThresholdRatioRepeatSearch(double)
    Esri::ArcGISRuntime::Toolkit::GenericListModel *sources() const
    Esri::ArcGISRuntime::Toolkit::GenericListModel *suggestions() const
    double thresholdRatioRepeatSearch()

    Signals

    Detailed Description

    Member Type Documentation

    enum class SearchViewController::SearchResultMode

    The result mode used by the controller to display results.

    ConstantValueDescription
    Esri::ArcGISRuntime::Toolkit::SearchViewController::SearchResultMode::Single0Always select the best result, even if multiple results are available.
    Esri::ArcGISRuntime::Toolkit::SearchViewController::SearchResultMode::Multiple1Always display results as a list, even if only one result is available.
    Esri::ArcGISRuntime::Toolkit::SearchViewController::SearchResultMode::Automatic2Show results as a list if there are multiple, otherwise if there is only one found result then select that result.

    See also Esri::ArcGISRuntime::Toolkit::SearchViewController::resultMode.

    Property Documentation

    activeSource : SearchSourceInterface*

    Access functions:

    Esri::ArcGISRuntime::Toolkit::SearchSourceInterface *activeSource() const
    void setActiveSource(Esri::ArcGISRuntime::Toolkit::SearchSourceInterface *activeSource)

    Notifier signal:

    automaticConfigurationEnabled : bool

    Access functions:

    bool isAutomaticConfigurationEnabled() const
    void setIsAutomaticConfigurationEnabled(bool isAutomaticConfigurationEnabled)

    Notifier signal:

    currentQuery : QString

    Access functions:

    QString currentQuery() const
    void setCurrentQuery(QString currentQuery)

    Notifier signal:

    defaultPlaceholder : QString

    Access functions:

    QString defaultPlaceholder() const
    void setDefaultPlaceholder(QString defaultPlaceholder)

    Notifier signal:

    eligableForRequery : bool

    Access functions:

    bool isEligableForRequery() const
    void setIsEligableForRequery(bool isEligableForRequery)

    Notifier signal:

    geoView : QObject*

    Access functions:

    QObject *geoView() const
    void setGeoView(QObject *geoView)

    Notifier signal:

    resultMode : SearchResultMode

    Access functions:

    Esri::ArcGISRuntime::Toolkit::SearchViewController::SearchResultMode resultMode() const
    void setResultMode(Esri::ArcGISRuntime::Toolkit::SearchViewController::SearchResultMode resultMode)

    Notifier signal:

    [read-only] results : QAbstractListModel* const

    Access functions:

    Esri::ArcGISRuntime::Toolkit::GenericListModel *results() const

    selectedResult : SearchResult*

    Access functions:

    Esri::ArcGISRuntime::Toolkit::SearchResult *selectedResult() const
    void setSelectedResult(Esri::ArcGISRuntime::Toolkit::SearchResult *selectedResult)

    Notifier signal:

    [read-only] sources : QAbstractListModel* const

    Access functions:

    Esri::ArcGISRuntime::Toolkit::GenericListModel *sources() const

    [read-only] suggestions : QAbstractListModel* const

    Access functions:

    Esri::ArcGISRuntime::Toolkit::GenericListModel *suggestions() const

    Member Function Documentation

    [invokable] SearchViewController::SearchViewController(QObject *parent = nullptr)

    Constructs a new SearchViewController object with a given parent.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [override virtual] SearchViewController::~SearchViewController()

    Destructor.

    [invokable] void SearchViewController::acceptSuggestion(Esri::ArcGISRuntime::Toolkit::SearchSuggestion *searchSuggestion)

    Starts a search using the given suggestion result searchSuggestion.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    Esri::ArcGISRuntime::Toolkit::SearchSourceInterface *SearchViewController::activeSource() const

    Returns the currently active search source. All sources are used if this property is null.

    Note: Getter function for property activeSource.

    See also setActiveSource().

    [signal] void SearchViewController::activeSourceChanged()

    Signal emitted when the activeSource changes.

    Note: Notifier signal for property activeSource.

    [invokable] void SearchViewController::clearSearch()

    Clears the search. This will clear results , suggestions, selectedResult and currentQuery.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [invokable] void SearchViewController::commitSearch(bool restrictToArea)

    Starts a search using the current query. When restrictToArea is true then the query will only look for results within the current queryArea.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    QString SearchViewController::currentQuery() const

    Returns the current user-entered query.

    This property drives both suggestions and searches.

    Note: Getter function for property currentQuery.

    See also setCurrentQuery().

    [signal] void SearchViewController::currentQueryChanged()

    Signal emitted when the currentQuery changes.

    Note: Notifier signal for property currentQuery.

    QString SearchViewController::defaultPlaceholder() const

    Returns the string shown in the search view when no user query is entered.

    Default is "Find a place or address".

    Note: Getter function for property defaultPlaceholder.

    See also setDefaultPlaceholder().

    [signal] void SearchViewController::defaultPlaceholderChanged()

    Signal emitted when the defaultPlaceholder changes.

    Note: Notifier signal for property defaultPlaceholder.

    QObject *SearchViewController::geoView() const

    Returns the GeoView as a QObject.

    Note: Getter function for property geoView.

    See also setGeoView().

    [signal] void SearchViewController::geoViewChanged()

    Signal emitted when the geoView changes.

    Note: Notifier signal for property geoView.

    bool SearchViewController::isAutomaticConfigurationEnabled() const

    Returns whether automatic configuration is enabled or not. Determines whether the view will update its configuration based on the attached geoview's geomodel automatically. This includes such properties as queryCenter, queryArea, and isEligableForRequery.

    Defaults to true.

    Note: Getter function for property automaticConfigurationEnabled.

    See also setIsAutomaticConfigurationEnabled().

    [signal] void SearchViewController::isAutomaticConfigurationEnabledChanged()

    Signal emitted when the isAutomaticConfigurationEnabled property changes.

    Note: Notifier signal for property automaticConfigurationEnabled.

    bool SearchViewController::isEligableForRequery() const

    Returns whether the user can perform a requery. A requery will perform the search at the same location, but will only look at results that exist within the current extent, ignoring all other results.

    Note: Getter function for property eligableForRequery.

    See also setIsEligableForRequery().

    [signal] void SearchViewController::isEligableForRequeryChanged()

    Signal emitted when the isEligableForRequery property changes.

    Note: Notifier signal for property eligableForRequery.

    Esri::ArcGISRuntime::Geometry SearchViewController::queryArea() const

    Returns the search area to be used for the current query.

    Ignored in most queries, unless the restrictToArea flag is set to true when calling SearchViewController::commitSearch.

    This property should be updated as the user navigates the map/scene, or at minimum before calling SearchViewController::commitSearch.

    Defaults to a default constructed Geometry.

    See also setQueryArea().

    [signal] void SearchViewController::queryAreaChanged()

    Signal emitted when the queryArea changes.

    Esri::ArcGISRuntime::Point SearchViewController::queryCenter() const

    Returns the center for the search.

    This property is used to weigh results in favour of those results closest to the center. This allows results to be local to the active viewpoint.

    This should be updated by the view every time the user navigates the map.

    Defaults to a default constructed Point.

    See also setQueryCenter().

    [signal] void SearchViewController::queryCenterChanged()

    Signal emitted when the queryCenter changes.

    Esri::ArcGISRuntime::Toolkit::SearchViewController::SearchResultMode SearchViewController::resultMode() const

    Returns the mode which dictates how results are displayed.

    With SearchResultMode::Automatic, if only a single result is found then this is automatically set as the selected result, otherwise when the is more than one possible result then the results property is populated with all possible results.

    With SearchResultMode::Multiple, the results property is always populated with all found results (even if there is only 1 result in the list).

    With SearchResultMode::Single, even if multiple results are found, the best result is automatically set as the "selected" result and the results property is never populated.

    The default value is SearchResultMode::Automatic.

    Note: Getter function for property resultMode.

    See also setResultMode().

    [signal] void SearchViewController::resultModeChanged()

    Signal emitted when the resultMode changes.

    Note: Notifier signal for property resultMode.

    Esri::ArcGISRuntime::Toolkit::GenericListModel *SearchViewController::results() const

    Returns the collection of found results.

    Defaults to an empty list.

    Note: Getter function for property results.

    Esri::ArcGISRuntime::Toolkit::SearchResult *SearchViewController::selectedResult() const

    Returns the selected result from the results collection.

    Defaults to null.

    Note: Getter function for property selectedResult.

    See also setSelectedResult() and resultMode.

    [signal] void SearchViewController::selectedResultChanged()

    Signal emitted when the selectedResult changes.

    Note: Notifier signal for property selectedResult.

    void SearchViewController::setActiveSource(Esri::ArcGISRuntime::Toolkit::SearchSourceInterface *activeSource)

    Sets the currently active search source to activeSource. All sources are used if this property is null.

    Note: Setter function for property activeSource.

    See also activeSource().

    void SearchViewController::setCurrentQuery(QString currentQuery)

    Sets the current user-entered query to currentQuery. This should be updated by the view after every key press.

    This property drives both suggestions and searches.

    Note: Setter function for property currentQuery.

    See also currentQuery().

    void SearchViewController::setDefaultPlaceholder(QString defaultPlaceholder)

    Sets the string shown in the search view when no user query is entered to defaultPlaceholder.

    Note: Setter function for property defaultPlaceholder.

    See also defaultPlaceholder().

    void SearchViewController::setGeoView(QObject *geoView)

    Set the GeoView object this Controller uses. This will reset internal state related to the old GeoView, such as the active query location and area.

    Internally this is cast to a MapView or SceneView using qobject_cast, which is why the paremeter is of form QObject and not GeoView.

    • geoView Object which must inherit from GeoView* and QObject*.

    Note: Setter function for property geoView.

    See also geoView().

    void SearchViewController::setIsAutomaticConfigurationEnabled(bool isAutomaticConfigurationEnabled)

    Sets whether automatic configuration is enabled to isAutomaticConfigurationEnabled.

    Note: Setter function for property automaticConfigurationEnabled.

    See also isAutomaticConfigurationEnabled().

    void SearchViewController::setIsEligableForRequery(bool isEligableForRequery)

    Sets whether the user can perform a requery to isEligableForRequery. When automaticConfigurationEnabled is true, and the user changes the viewpoint, this is automatically set to true. Clearing or changing the current query will set this property to false.

    Note: Setter function for property eligableForRequery.

    See also isEligableForRequery().

    void SearchViewController::setQueryArea(Esri::ArcGISRuntime::Geometry queryArea)

    Sets the search area to be used for the current query to queryArea.

    This property should be updated as the user navigates the map/scene, or at minimum before calling commitSearch.

    See also queryArea().

    void SearchViewController::setQueryCenter(Esri::ArcGISRuntime::Point queryCenter)

    Sets the center for the search to queryCenter.

    This should be updated by the view every time the user navigates the map.

    See also queryCenter().

    void SearchViewController::setResultMode(Esri::ArcGISRuntime::Toolkit::SearchViewController::SearchResultMode resultMode)

    Sets the mode which dictates how results are displayed to resultMode.

    Note: Setter function for property resultMode.

    See also resultMode().

    void SearchViewController::setSelectedResult(Esri::ArcGISRuntime::Toolkit::SearchResult *selectedResult)

    Sets the selected result from the results collection to selectedResult.

    Selecting a result will trigger changing the viewpoint of the geoView to that result if applicable.

    Note: Setter function for property selectedResult.

    See also selectedResult().

    Esri::ArcGISRuntime::Toolkit::GenericListModel *SearchViewController::sources() const

    Returns the collection of search sources to be used.

    Note: Getter function for property sources.

    Esri::ArcGISRuntime::Toolkit::GenericListModel *SearchViewController::suggestions() const

    Returns the collection of suggestion results from a query.

    Note: Getter function for property suggestions.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.