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 | Q |
Public Types
| enum | Attribute |
Public Functions
| virtual | ~ |
| Q | attribute |
| Q | attribute |
| Q | attributes |
| bool | contains |
| void | insert |
| bool | is |
| void | remove |
| void | remove |
| void | replace |
| void | set |
| int | size() const |
(since Esri bool | operator!=( |
| Esri | operator+=(const std |
| Esri | operator |
| bool | operator==( |
| Q | operator[](const Q |
Reimplemented Public Functions
| virtual Q | data(const Q |
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 | Q | The name/key for the attribute. Geodatabase fields are case insensitive. | Attribute |
| attribute | Q | 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.
AttributeListModel represents attribute keys as QString, but the underlying data structure represents these keys as case-insensitive strings.
See Internal data structures with case-insensitive string keys for further details.
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
[override virtual noexcept] AttributeListModel::~AttributeListModel ()
Destructor.
QStringList AttributeListModel::attributeNames () const
Returns a list of all the attribute names in the model.
AttributeListModel represents attribute names/keys as QString, but the underlying data structure represents these keys as case-insensitive strings.
See Internal data structures with case-insensitive string keys for further details.
QVariant AttributeListModel::attributeValue (const QString &attributeName ) const
Returns an attribute value by attributeName.
AttributeListModel represents attribute names/keys as QString, but the underlying data structure represents these keys as case-insensitive strings.
See Internal data structures with case-insensitive string keys for further details.
QVariantMap AttributeListModel::attributesMap () const
Returns the attributes in the model as a variant map.
AttributeListModel represents attribute names/keys as QString, but the underlying data structure represents these keys as case-insensitive strings.
See Internal data structures with case-insensitive string keys for further details.
See also setAttributesMap().
bool AttributeListModel::containsAttribute (const QString &attributeName ) const
Returns true if the model contains the provided attributeName.
AttributeListModel represents attribute names/keys as QString, but the underlying data structure represents these keys as case-insensitive strings.
See Internal data structures with case-insensitive string keys for further details.
[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.
[signal] void AttributeListModel::errorOccurred (const Esri::ArcGISRuntime::Error &error)
Signal emitted when an error occurs.
- error - Details about the error.
void AttributeListModel::insertAttribute (const QString &attributeName , const QVariant &attributeValue )
Inserts the value attributeValue of the attribute named attributeName.
AttributeListModel represents attribute names/keys as QString, but the underlying data structure represents these keys as case-insensitive strings.
See Internal data structures with case-insensitive string keys for further details.
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.
AttributeListModel represents attribute names/keys as QString, but the underlying data structure represents these keys as case-insensitive strings.
See Internal data structures with case-insensitive string keys for further details.
void AttributeListModel::replaceAttribute (const QString &attributeName , const QVariant &attributeValue )
Replaces the value attributeValue of the attribute named attributeName.
AttributeListModel represents attribute names/keys as QString, but the underlying data structure represents these keys as case-insensitive strings.
See Internal data structures with case-insensitive string keys for further details.
void AttributeListModel::setAttributesMap (const QVariantMap &attributes)
Replaces all attributes in the model with the provided attributes.
AttributeListModel represents attribute names/keys as QString, but the underlying data structure represents these keys as case-insensitive strings.
See Internal data structures with case-insensitive string keys for further details.
See also attributesMap().
int AttributeListModel::size() const
Returns the number of attributes in the model.
[since Esri::ArcGISRuntime 200.2] bool AttributeListModel::operator!=(Esri::ArcGISRuntime::AttributeListModel *other) const
Inequality operator. Returns true if this object and other are not equal.
This function was introduced in Esri::ArcGISRuntime 200.2.
See also AttributeListModel::operator==.
Esri::ArcGISRuntime::AttributeListModel &AttributeListModel::operator+=(const std::pair <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 std::pair <QString , QVariant > &attribute)
Inserts a key-value pair attribute into the model and returns a reference to the model. Geodatabase fields are case insensitive.
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.