GraphicListModel Class
A container class storing a list of graphics available in a GraphicsOverlay. More...
Header: | #include <GraphicListModel> |
Since: | Esri::ArcGISRuntime 100.0 |
Inherits: | QAbstractListModel and Esri::ArcGISRuntime::Iterable |
This class was introduced in Esri::ArcGISRuntime 100.0.
Public Types
enum | GraphicRoles { GraphicSelectedRole, GraphicVisibleRole, GraphicZIndexRole, GraphicAttributesRole } |
Public Functions
virtual | ~GraphicListModel() override |
void | append(Esri::ArcGISRuntime::Graphic *graphic) |
void | append(const QList<Esri::ArcGISRuntime::Graphic *> &graphics) |
void | clear() |
bool | contains(Esri::ArcGISRuntime::Graphic *graphic) const |
Esri::ArcGISRuntime::Graphic * | first() const |
int | indexOf(Esri::ArcGISRuntime::Graphic *graphic) const |
void | insert(int index, Esri::ArcGISRuntime::Graphic *graphic) |
bool | isEmpty() const |
Esri::ArcGISRuntime::Graphic * | last() const |
void | move(int from, int to) |
void | removeAt(int index) |
void | removeOne(Esri::ArcGISRuntime::Graphic *graphic) |
Reimplemented Public Functions
virtual Esri::ArcGISRuntime::Graphic * | at(int index) const override |
virtual QVariant | data(const QModelIndex &index, int role = Qt::DisplayRole) const override |
virtual int | size() const override |
Signals
void | graphicAdded(int index) |
void | graphicRemoved(int index) |
Detailed Description
Modifying this collection (adding, removing, moving) will update the graphics available in a GraphicsOverlay. Moving a graphic's position in the list model does not affect drawing order. To change drawing order, use the Graphic::zIndex property on each Graphic.
The model returns data for the following roles:
Role | Type | Description | GraphicRoles |
---|---|---|---|
selected | bool | Whether the graphic is selected. | GraphicSelectedRole |
graphicVisible | bool | Whether the graphic is visible. | GraphicVisibleRole |
zIndex | int | The z index of the graphic. | GraphicZIndexRole |
attributes | QVariantMap | The attributes of the graphic. | GraphicAttributesRole |
See also GraphicsOverlay and Graphic.
Member Type Documentation
enum GraphicListModel::GraphicRoles
This enum specifies the custom roles which can be used with GraphicListModel::data.
Constant | Value | Description |
---|---|---|
Esri::ArcGISRuntime::GraphicListModel::GraphicSelectedRole | Qt::UserRole + 1 | Whether the graphic is selected. |
Esri::ArcGISRuntime::GraphicListModel::GraphicVisibleRole | Qt::UserRole + 2 | Whether the graphic is visible. |
Esri::ArcGISRuntime::GraphicListModel::GraphicZIndexRole | Qt::UserRole + 3 | The z index of the graphic. |
Esri::ArcGISRuntime::GraphicListModel::GraphicAttributesRole | Qt::UserRole + 4 | The attributes of the graphic. |
Member Function Documentation
[signal]
void GraphicListModel::graphicAdded(int index)
Signal emitted when a graphic is added to the list.
index is the index of the added graphic.
[signal]
void GraphicListModel::graphicRemoved(int index)
Signal emitted when a graphic is removed from the list.
index is the index of the removed graphic.
[override virtual]
GraphicListModel::~GraphicListModel()
Destructor.
void GraphicListModel::append(Esri::ArcGISRuntime::Graphic *graphic)
Appends the graphic to the graphic list model.
void GraphicListModel::append(const QList<Esri::ArcGISRuntime::Graphic *> &graphics)
Appends graphics to the graphic list model.
[override virtual]
Esri::ArcGISRuntime::Graphic *GraphicListModel::at(int index) const
Returns the graphic at the specified index.
void GraphicListModel::clear()
Removes all graphics from the list model.
bool GraphicListModel::contains(Esri::ArcGISRuntime::Graphic *graphic) const
Returns true if the provided graphic is in the list model.
[override virtual]
QVariant GraphicListModel::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 graphic referred to by the index.
- index. The index in the model for which to return data.
- role. The role for which to return data.
Esri::ArcGISRuntime::Graphic *GraphicListModel::first() const
Returns the first graphic in the list model.
int GraphicListModel::indexOf(Esri::ArcGISRuntime::Graphic *graphic) const
Returns the index of the provided graphic in the list model.
void GraphicListModel::insert(int index, Esri::ArcGISRuntime::Graphic *graphic)
Inserts a graphic at a specified index in the list model.
bool GraphicListModel::isEmpty() const
Returns true if this list model is empty.
Esri::ArcGISRuntime::Graphic *GraphicListModel::last() const
Returns the last graphic in the list model.
void GraphicListModel::move(int from, int to)
Moves one graphic from an index in the list model to a different index.
Moving a graphic's position in the list model does not affect drawing order. To change drawing order, use the Graphic::zIndex property on each Graphic.
void GraphicListModel::removeAt(int index)
Removes a graphic at the specified index in the list model.
void GraphicListModel::removeOne(Esri::ArcGISRuntime::Graphic *graphic)
Removes the specified graphic from the list model.
[override virtual]
int GraphicListModel::size() const
Returns the number of graphics in the model.