A list model storing a list of key-value pairs to be used as attributes for a Feature or Graphic. More...
| Header | #include <Attribute |
| Since | Esri |
| Inherits | QAbstract |
This class was introduced in Esri::ArcGISRuntime 100.0.
Public Types
| enum | Attribute |
Public Functions
| virtual | ~ |
| QString | attribute |
| QVariant | attribute |
| QVariant | attributes |
| bool | contains |
| void | insert |
| bool | is |
| void | remove |
| void | remove |
| void | replace |
| void | set |
| int | size() const |
| Esri | operator+=(const QPair |
| Esri | operator |
| bool | operator==( |
| QVariant | operator[](const QString &attribute |
Reimplemented Public Functions
| virtual QVariant | data(const QModel |
Signals
| void | error |
Detailed Description
Modifying this model (adding or removing) will update the attributes available in the feature or graphic.
The model returns data for the following roles:
| Role | Type | Description | AttributeRoles |
|---|---|---|---|
| attribute | QString | The name/key for the attribute. | Attribute |
| attribute | QVariant | The value for the attribute. | Attribute |
JSON null values are specified as a default constructed QJsonValue when used with the AttributeListModel, for example:
const QVariant jsonNull(QJsonValue());
Values that don't exist are returned as a default constructed, invalid QVariant.
Member Type Documentation
enum AttributeListModel::AttributeRoles
This enum specifies the custom roles which can be used with AttributeListModel::data.
| Constant | Value | Description |
|---|---|---|
Esri | Qt | The name/key for the attribute. |
Esri | Qt | The value for the attribute. |
Member Function Documentation
[signal] void AttributeListModel::errorOccurred (Esri::ArcGISRuntime::Error error)
Signal emitted when an error occurs.
- error - Details about the error.
[override virtual] AttributeListModel::~AttributeListModel ()
Destructor.
QStringList AttributeListModel::attributeNames () const
Returns a list of all the attribute names in the model.
QVariant AttributeListModel::attributeValue (const QString &attributeName ) const
Returns an attribute value by attributeName.
QVariantMap AttributeListModel::attributesMap () const
Returns the attributes in the model as a variant map.
See also setAttributesMap().
bool AttributeListModel::containsAttribute (const QString &attributeName ) const
Returns true if the model contains the provided attributeName.
[override virtual] QVariant AttributeListModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const
Reimplements: QAbstractItemModel::data(const QModelIndex &index, int role) const.
Returns the data stored under the given role for the attribute referred to by the index.
- index - The index in the model for which to return data.
- role - The role for which to return data.
void AttributeListModel::insertAttribute (const QString &attributeName , const QVariant &attributeValue )
Inserts the value attributeValue of the attribute named attributeName.
See also operator+= and operator<<.
bool AttributeListModel::isEmpty () const
Returns true if the model contains no attributes.
void AttributeListModel::removeAllAttributes ()
Removes all attributes from the model.
void AttributeListModel::removeAttribute (const QString &attributeName )
Removes the attribute named attributeName from the model.
void AttributeListModel::replaceAttribute (const QString &attributeName , const QVariant &attributeValue )
Replaces the value attributeValue of the attribute named attributeName.
void AttributeListModel::setAttributesMap (const QVariantMap &attributes)
Replaces all attributes in the model with the provided attributes.
See also attributesMap().
int AttributeListModel::size() const
Returns the number of attributes in the model.
Esri::ArcGISRuntime::AttributeListModel &AttributeListModel::operator+=(const QPair<QString, QVariant> &attribute)
Inserts a key-value pair attribute into the model and returns a reference to the model.
See also insertAttribute and operator<<.
Esri::ArcGISRuntime::AttributeListModel &AttributeListModel::operator<< (const QPair<QString, QVariant> &attribute)
Inserts a key-value pair attribute into the model and returns a reference to the model.
See also insertAttribute and operator+=.
bool AttributeListModel::operator==(Esri::ArcGISRuntime::AttributeListModel *other) const
Equivalency operator.
Returns true if this object and other are equivalent.
QVariant AttributeListModel::operator[](const QString &attributeName ) const
Returns the attribute value matching the provided attributeName.
See also attributeValue.