Skip To Content ArcGIS for Developers Sign In Dashboard

PopupManager Class

class Esri::ArcGISRuntime::PopupManager

Manages the viewing and editing of a Popup. More...

Header: #include <PopupManager>
Since: Esri::ArcGISRuntime 100.0
Inherits: Esri::ArcGISRuntime::Object

This class was introduced in Esri::ArcGISRuntime 100.0.

Properties

Public Functions

PopupManager(Esri::ArcGISRuntime::Popup *popup, QObject *parent = nullptr)
virtual ~PopupManager() override
Esri::ArcGISRuntime::PopupAttachmentManager *attachmentManager() const
void cancelEditing()
QString customHtmlDescription() const
Esri::ArcGISRuntime::PopupAttributeListModel *displayedFields() const
bool doesChangeRequireNotification(const Esri::ArcGISRuntime::FeatureTemplate &featureTemplate) const
Esri::ArcGISRuntime::Domain domain(Esri::ArcGISRuntime::PopupField *popupField) const
QString editSummary() const
Esri::ArcGISRuntime::PopupAttributeListModel *editableFields() const
Esri::ArcGISRuntime::GeometryBuilder *editingGeometryBuilder() const
Esri::ArcGISRuntime::TaskWatcher evaluateExpressions()
QList<Esri::ArcGISRuntime::FeatureType> featureTypes() const
Esri::ArcGISRuntime::PopupField *fieldByName(const QString &fieldName) const
QString fieldLabel(Esri::ArcGISRuntime::PopupField *popupField) const
Esri::ArcGISRuntime::FieldType fieldType(Esri::ArcGISRuntime::PopupField *popupField) const
QVariant fieldValue(Esri::ArcGISRuntime::PopupField *popupField) const
void finishEditing()
QString formattedValue(Esri::ArcGISRuntime::PopupField *popupField) const
bool isDeleteAllowed() const
bool isEditGeometryAllowed() const
bool isEditing() const
bool isEditingAllowed() const
bool isFeatureType(Esri::ArcGISRuntime::PopupField *popupField) const
bool isGeoElementValid() const
bool isNullable(Esri::ArcGISRuntime::PopupField *popupField) const
bool isShowAttachments() const
bool isShowCustomHtmlDescription() const
bool isShowEditSummary() const
bool isShowMedia() const
int maxLength(Esri::ArcGISRuntime::PopupField *popupField) const
Esri::ArcGISRuntime::Popup *popup() const
QString rangeDomainValidationText(Esri::ArcGISRuntime::PopupField *popupField) const
void setEditingGeometryBuilder(Esri::ArcGISRuntime::GeometryBuilder *builder)
bool startEditing()
QString substitute(const QString &templateString) const
Esri::ArcGISRuntime::Symbol *symbol() const
QString title() const
Esri::ArcGISRuntime::Error updateValue(const QVariant &newValue, Esri::ArcGISRuntime::PopupField *popupField)
Esri::ArcGISRuntime::Error updateValue(const Esri::ArcGISRuntime::FeatureTemplate &featureTemplate, Esri::ArcGISRuntime::FeatureTypeChangeMode changeMode)
Esri::ArcGISRuntime::Error validationError(Esri::ArcGISRuntime::PopupField *popupField) const

Signals

void editingCompleted(Esri::ArcGISRuntime::Error error)
void evaluateExpressionsCompleted(QUuid taskId, const QList<Esri::ArcGISRuntime::PopupExpressionEvaluation *> &popupExpressionEvaluationResults)
void featureTypeChanged()
void geoElementValidChanged()
void geometryBuilderRequired()

Detailed Description

This class works in conjunction with the PopupView in the ArcGIS Runtime Toolkit. The PopupView is used to display information about a GeoElement. For example, a PopupView could be used to display the attributes of an ArcGISFeature that is stored in a Feature Service. PopupManager provides the PopupView with the content to display in the view. It also contains many helper functions and properties to assist the PopupView with displaying and editing information related to the associated GeoElement.

An example workflow for displaying a PopupView using a PopupManager would be:

  • Declare a PopupView and anchor it to a desired location.
  • Perform an identify operation on a GeoView and select a Feature from the identify result.
  • Create a Popup from the Feature.
  • Optionally obtain the Popup's PopupDefinition and set the title, whether to show attachments, and so on.
  • Create a PopupManager from the Popup.
  • Assign the PopupView's popupManager property the PopupManager created in the previous step.
  • Call the show() method to display the PopupView.
  • Call the dismiss() method to hide the PopupView.

Note: Each time a change is made to the Popup, PopupDefinition, PopupManager, or any of their properties, the PopupManager must be re-set to the PopupView.

In order to use the PopupManager with a QML UI, the PopupManager, PopupAttachmentManager, PopupAttachmentListModel, and PopupAttributeListModel classes must be registered as QML Types. For example, the following lines could be added to the main.cpp to register the classes under the Esri.Samples namespace:

qmlRegisterUncreatableType<PopupManager>("Esri.Samples", 1, 0, "PopupManager", "PopupManager is uncreateable");
qmlRegisterUncreatableType<PopupAttachmentManager>("Esri.Samples", 1, 0, "PopupAttachmentManager", "PopupAttachmentManager is uncreateable");
qmlRegisterUncreatableType<PopupAttributeListModel>("Esri.Samples", 1, 0, "PopupAttributeListModel", "PopupAttributeListModel is uncreateable");
qmlRegisterUncreatableType<PopupAttachmentListModel>("Esri.Samples", 1, 0, "PopupAttachmentListModel", "PopupAttachmentListModel is uncreateable");

Note: The default PopupView 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 PopupManager.

Property Documentation

attachmentManager : PopupAttachmentManager* const

This property holds the Popup's PopupAttachmentManager (read-only).

Access functions:

Esri::ArcGISRuntime::PopupAttachmentManager *attachmentManager() const

customHtmlDescription : const QString

This property holds the Popup's custom HTML description (read-only).

Access functions:

QString customHtmlDescription() const

deleteAllowed : const bool

This property holds whether features can be deleted (read-only).

Access functions:

bool isDeleteAllowed() const

displayedFields : PopupAttributeListModel* const

This property holds the Popup's display fields as a PopupAttributeListModel (read-only).

Access functions:

Esri::ArcGISRuntime::PopupAttributeListModel *displayedFields() const

editGeometryAllowed : const bool

This property holds whether editing a feature's geometry is allowed (read-only).

Access functions:

bool isEditGeometryAllowed() const

editSummary : const QString

This property holds the Popup's edit summary (read-only).

Access functions:

QString editSummary() const

editableFields : PopupAttributeListModel* const

This property holds the Popup's editable fields as a PopupAttributeListModel (read-only).

Access functions:

Esri::ArcGISRuntime::PopupAttributeListModel *editableFields() const

editing : const bool

This property holds whether the PopupManager is in editing mode (read-only).

Access functions:

bool isEditing() const

editingAllowed : const bool

This property holds whether editing a feature is allowed (read-only).

Access functions:

bool isEditingAllowed() const

geoElementValid : const bool

This property holds whether the Popup's GeoElement is valid (read-only).

Access functions:

bool isGeoElementValid() const

showAttachments : const bool

This property holds whether attachments should be shown in the PopupView (read-only).

Access functions:

bool isShowAttachments() const

showCustomHtmlDescription : const bool

This property holds whether a custom HTML description should be shown in the PopupView (read-only).

Access functions:

showEditSummary : const bool

This property holds whether the edit summary should be shown in the PopupView (read-only).

Access functions:

bool isShowEditSummary() const

showMedia : const bool

This property holds whether media should be shown in the PopupView (read-only).

Access functions:

bool isShowMedia() const

title : const QString

This property holds the Popup's title (read-only).

Access functions:

QString title() const

Member Function Documentation

PopupManager::PopupManager(Esri::ArcGISRuntime::Popup *popup, QObject *parent = nullptr)

Constructor that takes a popup with an optional parent.

[signal] void PopupManager::editingCompleted(Esri::ArcGISRuntime::Error error)

Signal emitted when editing completes after finishEditing is called.

  • error - The Error object.

[signal] void PopupManager::evaluateExpressionsCompleted(QUuid taskId, const QList<Esri::ArcGISRuntime::PopupExpressionEvaluation *> &popupExpressionEvaluationResults)

Signal emitted when evaluateExpressions completes.

  • taskId - The task ID of the asynchronous task.
  • popupExpressionEvaluationResults - The generated list of PopupExpressionEvaluation.

The returned PopupExpressionEvaluation objects have the PopupManager as its parent.

See also Returned QObjects Parenting.

[signal] void PopupManager::featureTypeChanged()

Signal emitted when isFeatureType changes.

[signal] void PopupManager::geoElementValidChanged()

Signal emitted when isGeoElementValid changes.

[signal] void PopupManager::geometryBuilderRequired()

Signal emitted when a geometry builder is required.

[override virtual] PopupManager::~PopupManager()

Destructor.

Esri::ArcGISRuntime::PopupAttachmentManager *PopupManager::attachmentManager() const

Returns the PopupAttachmentManager for this PopupManager.

Returns null if there is no associated PopupAttachmentManager.

Note: Getter function for property attachmentManager.

This function was introduced in Esri::ArcGISRuntime 100.1.

void PopupManager::cancelEditing()

Cancels the editing session.

Any edits that have been made since starting will be discarded.

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

QString PopupManager::customHtmlDescription() const

Returns the text to display as the custom HTML description.

If PopupDefinition::expressions is not empty, the custom HTML description may be using expressions with Arcade FeatureSet functions. Use PopupManager::evaluateExpressions() to evaluate the Arcade expressions before trying to get the PopupManager::customHtmlDescription() otherwise it may not return the correct description.

Note: Getter function for property customHtmlDescription.

Esri::ArcGISRuntime::PopupAttributeListModel *PopupManager::displayedFields() const

Returns the fields for display use as a PopupAttributeListModel.

Note: Getter function for property displayedFields.

bool PopupManager::doesChangeRequireNotification(const Esri::ArcGISRuntime::FeatureTemplate &featureTemplate) const

Returns whether changes to the specified featureTemplate requires a notification to the user that some data may be overwritten by the change.

Esri::ArcGISRuntime::Domain PopupManager::domain(Esri::ArcGISRuntime::PopupField *popupField) const

Returns the Domain of the specified popupField.

QString PopupManager::editSummary() const

Returns the current edit summary.

Note: Getter function for property editSummary.

Esri::ArcGISRuntime::PopupAttributeListModel *PopupManager::editableFields() const

Returns the editable fields as a PopupAttributeListModel.

Note: Getter function for property editableFields.

Esri::ArcGISRuntime::GeometryBuilder *PopupManager::editingGeometryBuilder() const

Returns the GeometryBuilder used to edit the GeoElement's geometry.

See also setEditingGeometryBuilder().

Esri::ArcGISRuntime::TaskWatcher PopupManager::evaluateExpressions()

Asynchronously evaluates all expressions, including Arcade FeatureSet functions, available at PopupDefinition::expressions(). This method must be called before displaying the popup information in a UI so you can use synchronous methods Popup::formattedValue() and PopupManager::substitute() to get the formatted string representation. If there are no PopupDefinition::expressions() then the result list will be empty.

The PopupExpression may be used in the PopupDefinition::fields(), PopupDefinition::media(), PopupDefinition::title() and PopupDefinition::description().

This function was introduced in Esri::ArcGISRuntime 100.8.

QList<Esri::ArcGISRuntime::FeatureType> PopupManager::featureTypes() const

Returns a list of FeatureTypes or an empty list if the GeoElement is not an ArcGISFeature in an ArcGISFeatureTable.

Esri::ArcGISRuntime::PopupField *PopupManager::fieldByName(const QString &fieldName) const

Returns the PopupField object corresponding to the specified fieldName.

This will return nullptr if there is no such field or if the GeoElement is not an ArcGISFeature with fields.

QString PopupManager::fieldLabel(Esri::ArcGISRuntime::PopupField *popupField) const

Returns the label of the specified popupField.

If the field is based on a PopupExpression, the title of the expression will be returned.

This function was introduced in Esri::ArcGISRuntime 100.3.

Esri::ArcGISRuntime::FieldType PopupManager::fieldType(Esri::ArcGISRuntime::PopupField *popupField) const

Returns the FieldType of the specified popupField.

QVariant PopupManager::fieldValue(Esri::ArcGISRuntime::PopupField *popupField) const

Returns the value of the specified popupField.

void PopupManager::finishEditing()

Finishes the editing session.

This runs asynchronously, and editingCompleted signal emit once the editing session has ended.

Note: The PopupManager does not automatically call applyEdits on the associated GeoElement's ArcGISFeatureTable. To commit any edits to the source data, call applyEdits on the associated ArcGISFeatureTable.

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

QString PopupManager::formattedValue(Esri::ArcGISRuntime::PopupField *popupField) const

Returns a formatted string representation of the specified popupField.

If PopupDefinition::expressions is not empty, the PopupField may be using expressions with Arcade FeatureSet functions. Use PopupManager::evaluateExpressions() to evaluate the Arcade expressions before trying to get the formatted string representation of the popup field's value, otherwise it may return an empty string.

bool PopupManager::isDeleteAllowed() const

Returns whether deleting the GeoElement is allowed.

Note: Getter function for property deleteAllowed.

bool PopupManager::isEditGeometryAllowed() const

Returns whether geometry editing is allowed.

Note: Getter function for property editGeometryAllowed.

bool PopupManager::isEditing() const

Returns whether the PopupManager is currently in editing mode.

Note: Getter function for property editing.

bool PopupManager::isEditingAllowed() const

Returns whether attribute editing is allowed.

Note: Getter function for property editingAllowed.

bool PopupManager::isFeatureType(Esri::ArcGISRuntime::PopupField *popupField) const

Returns whether the specified popupField is a FeatureType field.

bool PopupManager::isGeoElementValid() const

Returns whether the GeoElement is valid.

Note: Getter function for property geoElementValid.

bool PopupManager::isNullable(Esri::ArcGISRuntime::PopupField *popupField) const

Returns whether the specified popupField is nullable.

bool PopupManager::isShowAttachments() const

Returns whether attachments should be shown.

Note: Getter function for property showAttachments.

bool PopupManager::isShowCustomHtmlDescription() const

Returns whether the showCustomHtmlDescription should be shown.

Note: Getter function for property showCustomHtmlDescription.

bool PopupManager::isShowEditSummary() const

Returns whether the showEditSummary should be shown.

Note: Getter function for property showEditSummary.

bool PopupManager::isShowMedia() const

Returns whether media should be shown.

Note: Getter function for property showMedia.

int PopupManager::maxLength(Esri::ArcGISRuntime::PopupField *popupField) const

Returns the maximum allowed length of the specified popupField.

Returns the Popup that is being managed.

QString PopupManager::rangeDomainValidationText(Esri::ArcGISRuntime::PopupField *popupField) const

Returns a string that can be used to hint the acceptable values for a RangeDomain in a popupField.

void PopupManager::setEditingGeometryBuilder(Esri::ArcGISRuntime::GeometryBuilder *builder)

Sets the GeometryBuilder used to edit the GeoElement's geometry.

See also editingGeometryBuilder().

bool PopupManager::startEditing()

Initiates an editing session with the Popup.

Returns true if editing was started successfully and false if editing is already started or not allowed.

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

QString PopupManager::substitute(const QString &templateString) const

Substitutes attribute values for attribute place-holders in a given templateString.

If PopupDefinition::expressions is not empty, the input string may be using expressions with Arcade FeatureSet functions. Use PopupManager::evaluateExpressions() to evaluate the Arcade expressions before trying to get the substitute string, otherwise it may return an empty string.

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

Esri::ArcGISRuntime::Symbol *PopupManager::symbol() const

Returns the Symbol of the Popup.

QString PopupManager::title() const

Returns the Popup's title text.

Note: Getter function for property title.

Esri::ArcGISRuntime::Error PopupManager::updateValue(const QVariant &newValue, Esri::ArcGISRuntime::PopupField *popupField)

Updates the value of the specified popupField to the specified newValue.

Esri::ArcGISRuntime::Error PopupManager::updateValue(const Esri::ArcGISRuntime::FeatureTemplate &featureTemplate, Esri::ArcGISRuntime::FeatureTypeChangeMode changeMode)

Updates the GeoElement's featureTemplate, which in turn updates the values of its attribute table to match those in the feature template, dependent on the changeMode.

Esri::ArcGISRuntime::Error PopupManager::validationError(Esri::ArcGISRuntime::PopupField *popupField) const

Returns the validation Error for the specified popupField.


Feedback on this topic?