CalloutData Class

  • CalloutData
  • class Esri::ArcGISRuntime::CalloutData

    The data for a Callout view. More...

    Header: #include <CalloutData.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::Object

    Properties

    Public Functions

    virtual ~CalloutData() override
    QString detail() const
    QString detailExpression() const
    Esri::ArcGISRuntime::GeoElement *geoElement() const
    QImage image() const
    QUrl imageUrl() const
    bool isShowCalloutForLocationDisplay() const
    bool isVisible() const
    Esri::ArcGISRuntime::Point location() const
    QPointF screenPoint() const
    void setDetail(const QString &detail)
    void setDetailExpression(const QString &detailExpression)
    void setGeoElement(Esri::ArcGISRuntime::GeoElement *geoElement)
    void setImage(const QImage &image)
    void setImageUrl(const QUrl &imageUrl)
    void setLocation(const Esri::ArcGISRuntime::Point &location)
    void setShowCalloutForLocationDisplay(bool calloutForLocationDisplay)
    void setTapLocation(const Esri::ArcGISRuntime::Point &tapLocation)
    void setTitle(const QString &title)
    void setTitleExpression(const QString &titleExpression)
    void setVisible(bool visible)
    Esri::ArcGISRuntime::Point tapLocation() const
    QString title() const
    QString titleExpression() const

    Signals

    Detailed Description

    This class works in conjunction with the Callout view in the ArcGIS Maps SDK Toolkit, which is used to display information on a map. CalloutData provides the Callout with the content to display in the view and the screen coordinates detailing where to display the view. The content of the callout consists of a title and a detail string. It can also display an image to the left of the title and detail, and an accessory button to the right. The accessory button can be used to present a secondary view with more details, such as a pop up.

    A Callout can be displayed for several different scenarios:

    Obtain CalloutData from MapView::calloutData. You can change the content of the callout by setting properties on this class. To change the look and feel of the Callout view, set properties on the Callout in the toolkit.

    In order to use the CalloutData with a QML UI, the CalloutData class must be registered as a QML Type. For example, the following line could be added to the main.cpp to register the class under the Esri.Samples namespace:

    qmlRegisterUncreatableType<CalloutData>("Esri.Samples", 1, 0, "CalloutData", "CalloutData is an uncreatable type");

    Note: The default Callout provided with the toolkit is built with Qt Quick for a QML UI. If using Qt Widgets, a custom Widgets UI could be created to consume the information provided by CalloutData.

    Example:

    Initialize the CalloutData so the QML property is updated:

    m_mapView->calloutData()->setVisible(false);
    m_mapView->calloutData()->setTitle("Location");
    QImage image(":/Samples/DisplayInformation/ShowCallout/RedShinyPin.png");
    m_mapView->calloutData()->setImage(image);

    Finally, set the CalloutData to the Callout view component from the Toolkit:

    Callout {
        id: callout
        calloutData: mapView.calloutData // bind to the property that is exposed
        accessoryButtonVisible: false
        leaderPosition: Callout.LeaderPosition.Automatic
    }

    Property Documentation

    detail : QString

    This property holds the detail text for the callout. If detailExpression has been set, the detail will be overwritten by the evaluated detailExpression result.

    Access functions:

    QString detail() const
    void setDetail(const QString &detail)

    Notifier signal:

    void detailChanged()

    See also detailExpression.

    imageUrl : QUrl

    This property holds the local file or online URL of the callout image.

    Access functions:

    QUrl imageUrl() const
    void setImageUrl(const QUrl &imageUrl)

    Notifier signal:

    [read-only] screenPoint : const QPointF

    This property holds the screen coordinates where the callout is displayed (read-only).

    Access functions:

    QPointF screenPoint() const

    Notifier signal:

    title : QString

    This property holds the title text for the callout. If titleExpression has been set, the title will be overwritten by the evaluated titleExpression result.

    Access functions:

    QString title() const
    void setTitle(const QString &title)

    Notifier signal:

    void titleChanged()

    See also titleExpression.

    visible : bool

    This property holds whether the Callout is visible.

    Returns true if the Callout is visible.

    Access functions:

    bool isVisible() const
    void setVisible(bool visible)

    Notifier signal:

    Member Function Documentation

    [override virtual] CalloutData::~CalloutData()

    Destructor.

    [signal] void CalloutData::detailChanged()

    Emitted when the detail property changes.

    Note: Notifier signal for property detail.

    [since Esri::ArcGISRuntime 200.4] QString CalloutData::detailExpression() const

    Returns an Arcade expression used for evaluating the detail text based on attributes in the GeoElement.

    This function was introduced in Esri::ArcGISRuntime 200.4.

    See also detail and setDetailExpression.

    Esri::ArcGISRuntime::GeoElement *CalloutData::geoElement() const

    Gets the GeoElement for which the callout should be displayed.

    If you specify the optional tapLocation parameter, the callout displays at the point on the geometry nearest to tapLocation.

    Note: Only supports Feature and Graphic GeoElements.

    See also setGeoElement().

    QImage CalloutData::image() const

    The callout image returned as a QImage.

    See also setImage().

    [signal] void CalloutData::imageUrlChanged()

    Emitted when the imageUrl property changes.

    Note: Notifier signal for property imageUrl.

    bool CalloutData::isShowCalloutForLocationDisplay() const

    Gets whether the callout is being shown for the LocationDisplay on the map.

    Returns true if the callout will display at the current location.

    Esri::ArcGISRuntime::Point CalloutData::location() const

    Gets the map location where the callout should be displayed.

    See also setLocation().

    [signal] void CalloutData::screenPointChanged()

    Emitted when the screenPoint property changes.

    Note: Notifier signal for property screenPoint.

    void CalloutData::setDetail(const QString &detail)

    Sets the detail text for the callout to detail.

    Note: Setter function for property detail.

    See also detail().

    [since Esri::ArcGISRuntime 200.4] void CalloutData::setDetailExpression(const QString &detailExpression)

    Sets the Arcade expression to evaluate and show the callout detail.

    detailExpression is an Arcade expression used to evaluate the detail text based on attributes in the GeoElement. Set DynamicEntity to setGeoElement in order to evaluate the expression and update the attributes realtime in callout detail.

    Use the attributes of the dynamic entity to form the detailExpression and pass to setDetailExpression(const QString&). For example, to show the callout detail based on the attribute values of dynamic entity, form the detailExpression as follows: concatenate(Round($feature.point_x,6), \",\", Round($feature.point_y,6),\" Heading: \",$feature.heading,\"°\"). Note: Dynamic entity is set to $feature in the profile variable. Then set setVisible to true to show the callout.

    The result will be stored in detail after the detailExpression evaluation. The expression is re-evaluated every time the dynamic entity's DynamicEntity::dynamicEntityChanged signal is emitted, and the callout title is updated in real-time when it moves along with the dynamic entity. If both detail and detailExpression are provided, detail will be overwritten by the evaluated detailExpression result.

    This function was introduced in Esri::ArcGISRuntime 200.4.

    See also detailExpression and detail.

    void CalloutData::setGeoElement(Esri::ArcGISRuntime::GeoElement *geoElement)

    Sets the GeoElement for the callout geoElement.

    See also geoElement().

    void CalloutData::setImage(const QImage &image)

    Sets the image for the callout.

    The image can be set by either specifying the QImage or by a URL using the setImageUrl method. It overwrites a previously set imageUrl.

    See also image().

    void CalloutData::setImageUrl(const QUrl &imageUrl)

    Sets the imageUrl for the callout.

    The URL can either be to a local file or an online resource.

    Note: Setter function for property imageUrl.

    See also imageUrl().

    void CalloutData::setLocation(const Esri::ArcGISRuntime::Point &location)

    Sets the location of the callout display to location.

    See also location().

    void CalloutData::setShowCalloutForLocationDisplay(bool calloutForLocationDisplay)

    Sets whether the callout is being shown for the LocationDisplay on the map.

    Set calloutForLocationDisplay to true if you want the callout to be displayed for your current location.

    See also isShowCalloutForLocationDisplay().

    void CalloutData::setTapLocation(const Esri::ArcGISRuntime::Point &tapLocation)

    Sets the tap location for the callout to tapLocation.

    If the callout is shown for a GeoElement, tapLocation specifies the optional location where the callout should be displayed.

    See also tapLocation().

    void CalloutData::setTitle(const QString &title)

    Sets the title text for the callout to title.

    Note: Setter function for property title.

    See also title().

    [since Esri::ArcGISRuntime 200.4] void CalloutData::setTitleExpression(const QString &titleExpression)

    Sets an Arcade expression to evaluate and show the callout title.

    titleExpression is an Arcade expression used to evaluate the title text based on attributes in the GeoElement. Set DynamicEntity to setGeoElement in order to evaluate the expression and update the title realtime in callout.

    Use the attributes of dynamic entity to form the titleExpression and pass to setTitleExpression(const QString&). For example, to show the callout title based on the attributes of dynamic entity, form the titleExpression as follows: concatenate($feature.vehiclename, \": \", $feature.speed, \" mph\"). Note: Dynamic entity is set to $feature in the profile variable. Then set setVisible to true to show the callout.

    The result will be stored in title after the titleExpression evaluation. The expression is re-evaluated every time the dynamic entity's DynamicEntity::dynamicEntityChanged signal is emitted, and the callout title is updated in real-time when it moves along with the dynamic entity. If both title and titleExpression are provided, title will be overwritten by the evaluated titleExpression result.

    This function was introduced in Esri::ArcGISRuntime 200.4.

    See also titleExpression and title.

    void CalloutData::setVisible(bool visible)

    Sets the callout to be visible or invisible.

    Note: Setter function for property visible.

    See also isVisible().

    Esri::ArcGISRuntime::Point CalloutData::tapLocation() const

    Gets the tap location for the callout.

    See also setTapLocation().

    [signal] void CalloutData::titleChanged()

    Emitted when the title property changes.

    Note: Notifier signal for property title.

    [since Esri::ArcGISRuntime 200.4] QString CalloutData::titleExpression() const

    Returns an Arcade expression used for evaluating the title text based on the attributes in the GeoElement.

    This function was introduced in Esri::ArcGISRuntime 200.4.

    See also setTitleExpression(), title, and titleExpression.

    [signal] void CalloutData::visibleChanged()

    Emitted when the visible property changes.

    Note: Notifier signal for property visible.

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