30 , mItemCheckable( false )
39 , mItemCheckable( false )
81 Q_FOREACH (
const QString& layerId, layerIds )
85 if ( !list.isEmpty() )
109 if (
hasIndex( row, column, parent ) )
142 if ( role == Qt::DisplayRole )
145 return layer->
name();
160 if ( role == Qt::DecorationRole )
164 if ( role == Qt::DecorationRole )
227 flags |= Qt::ItemIsUserCheckable;
235 if ( role == Qt::CheckStateRole )
bool hasIndex(int row, int column, const QModelIndex &parent) const
QVariant data(const QModelIndex &index, int role) const override
Base class for all map layer types.
QgsMapLayer::LayerType type() const
Get the type of the layer.
QString name() const
Get the display name of the layer.
LayerType
Layers enum defining the types of layers that can be added to a map.
static const QIcon & iconPoint()
QList< QgsMapLayer * > mLayers
int columnCount(const QModelIndex &parent) const override
void checkAll(Qt::CheckState checkState)
checkAll changes the checkstate for all the layers
bool setData(const QModelIndex &index, const QVariant &value, int role) override
QModelIndex indexFromLayer(QgsMapLayer *layer) const
indexFromLayer returns the model index for a given layer
static const QIcon & iconPolygon()
void setItemsCheckable(bool checkable)
setItemsCheckable defines if layers should be selectable in the widget
QgsMapLayerModel(QObject *parent=nullptr)
QgsMapLayerModel creates a model to display layers in widgets.
int indexOf(const T &value, int from) const
QList< Key > keys() const
virtual QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits, QFlags< Qt::MatchFlag > flags) const
void removeLayers(const QStringList &layerIds)
int count(const T &value) const
void append(const T &value)
int toInt(bool *ok) const
Qt::ItemFlags flags(const QModelIndex &index) const override
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
static const QIcon & iconRaster()
void addLayers(const QList< QgsMapLayer * > &layers)
void beginRemoveRows(const QModelIndex &parent, int first, int last)
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QMap< QString, Qt::CheckState > mLayersChecked
void * internalPointer() const
QString id() const
Get this layer's unique ID, this ID is used to access this layer from map layer registry.
QGis::GeometryType geometryType() const
Returns point, line or polygon.
int rowCount(const QModelIndex &parent) const override
QModelIndex createIndex(int row, int column, void *ptr) const
void beginInsertRows(const QModelIndex &parent, int first, int last)
static const QIcon & iconTable()
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
static const int LayerIdRole
static const QIcon & iconLine()
iterator insert(const Key &key, const T &value)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Represents a vector layer which manages a vector based data sets.
QList< QgsMapLayer * > layersChecked(Qt::CheckState checkState=Qt::Checked)
layersChecked returns the list of layers which are checked (or unchecked)
int remove(const Key &key)