A list model storing a list of LabelDefinitions. More...
Header: | #include <LabelDefinitionListModel.h> |
Since: | Esri::ArcGISRuntime 100.1 |
Inherits: | QAbstractListModel and Esri::ArcGISRuntime::Iterable |
Public Types
enum | LabelDefinitionRoles { LabelDefinitionJsonRole } |
Public Functions
virtual | ~LabelDefinitionListModel() override |
void | append(Esri::ArcGISRuntime::LabelDefinition *labelDefinition) |
void | clear() |
bool | contains(Esri::ArcGISRuntime::LabelDefinition *labelDefinition) const |
Esri::ArcGISRuntime::LabelDefinition * | first() const |
int | indexOf(Esri::ArcGISRuntime::LabelDefinition *labelDefinition) const |
void | insert(int index, Esri::ArcGISRuntime::LabelDefinition *labelDefinition) |
bool | isEmpty() const |
Esri::ArcGISRuntime::LabelDefinition * | last() const |
void | move(int from, int to) |
void | removeAt(int index) |
void | removeOne(Esri::ArcGISRuntime::LabelDefinition *labelDefinition) |
Reimplemented Public Functions
virtual Esri::ArcGISRuntime::LabelDefinition * | at(int index) const override |
virtual QVariant | data(const QModelIndex &index, int role = Qt::DisplayRole) const override |
virtual int | size() const override |
Signals
void | errorOccurred(const Esri::ArcGISRuntime::Error &error) |
void | itemAdded(int index) |
void | itemRemoved(int index) |
Detailed Description
Modifying this model (adding, removing, moving) will update the LabelDefinitions belonging to the model's parent type (ArcGISMapImageSublayer, FeatureLayer or GraphicsOverlay).
The model returns data for the following roles:
Role | Type | Description | SublayerRoles |
---|---|---|---|
LabelDefinitionJson | QString | A LabelDefinition's JSON. | LabelDefinitionJsonRole |
Member Type Documentation
enum LabelDefinitionListModel::LabelDefinitionRoles
This enum specifies the custom roles which can be used with LabelDefinitionListModel::data.
Constant | Value | Description |
---|---|---|
Esri::ArcGISRuntime::LabelDefinitionListModel::LabelDefinitionJsonRole | Qt::UserRole + 1 | A LabelDefinition's JSON string. |
Member Function Documentation
[override virtual]
LabelDefinitionListModel::~LabelDefinitionListModel ()
Destructor.
void LabelDefinitionListModel::append(Esri::ArcGISRuntime::LabelDefinition *labelDefinition )
Appends a labelDefinition to the LabelDefinition list model.
[override virtual]
Esri::ArcGISRuntime::LabelDefinition *LabelDefinitionListModel::at(int index) const
Returns the LabelDefinition
at the specified index.
void LabelDefinitionListModel::clear()
Removes all LabelDefinitions from the list model.
List models do not take ownership of the objects they contain. Therefore, removing or clearing objects from the list model will not delete those objects. An RAII technique should be used to ensure that memory is properly deallocated.
bool LabelDefinitionListModel::contains(Esri::ArcGISRuntime::LabelDefinition *labelDefinition ) const
Returns true
if the list model contains the specified labelDefinition.
[override virtual]
QVariant LabelDefinitionListModel::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 LabelDefinition 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 LabelDefinitionListModel::errorOccurred (const Esri::ArcGISRuntime::Error &error)
Signal emitted when an error occurs.
- error - Details about the error.
Esri::ArcGISRuntime::LabelDefinition *LabelDefinitionListModel::first() const
Returns the first LabelDefinition in the list model.
int LabelDefinitionListModel::indexOf (Esri::ArcGISRuntime::LabelDefinition *labelDefinition ) const
Returns the index of the labelDefinition specified.
void LabelDefinitionListModel::insert(int index, Esri::ArcGISRuntime::LabelDefinition *labelDefinition )
Inserts a labelDefinition at a specified index in the list model.
This method will append to the list if the index is greater than the current size of the list model.
bool LabelDefinitionListModel::isEmpty () const
Returns true
if the list model contains no LabelDefinitions.
[signal, since Esri::ArcGISRuntime 100.15]
void LabelDefinitionListModel::itemAdded (int index)
Signal emitted when an item is added to the list model.
- index is the index of the added item.
This function was introduced in Esri::ArcGISRuntime 100.15.
[signal, since Esri::ArcGISRuntime 100.15]
void LabelDefinitionListModel::itemRemoved (int index)
Signal emitted when an item is removed from the list model.
- index is the index of the removed item.
This function was introduced in Esri::ArcGISRuntime 100.15.
Esri::ArcGISRuntime::LabelDefinition *LabelDefinitionListModel::last() const
Returns the last LabelDefinition in the list model.
void LabelDefinitionListModel::move(int from, int to)
Moves one LabelDefinition from an index in the list model to a different index.
void LabelDefinitionListModel::removeAt (int index)
Removes a LabelDefinition at the specified index.
List models do not take ownership of the objects they contain. Therefore, removing or clearing objects from the list model will not delete those objects. An RAII technique should be used to ensure that memory is properly deallocated.
void LabelDefinitionListModel::removeOne (Esri::ArcGISRuntime::LabelDefinition *labelDefinition )
Removes the specified labelDefinition from the list model.
List models do not take ownership of the objects they contain. Therefore, removing or clearing objects from the list model will not delete those objects. An RAII technique should be used to ensure that memory is properly deallocated.
[override virtual]
int LabelDefinitionListModel::size() const
Returns the number of LabelDefinitions contained in the list model.