28 , mItemCheckable( false )
79 Q_FOREACH (
const QString& layerId, layerIds )
83 if ( !list.isEmpty() )
107 if (
hasIndex( row, column, parent ) )
140 if ( role == Qt::DisplayRole )
143 return layer->
name();
163 if ( role == Qt::DecorationRole )
167 if ( role == Qt::DecorationRole )
219 #if QT_VERSION >= 0x050000 240 flags |= Qt::ItemIsUserCheckable;
248 if ( role == Qt::CheckStateRole )
bool hasIndex(int row, int column, const QModelIndex &parent) const
QObject * child(const char *objName, const char *inheritsClass, bool recursiveSearch) const
QVariant data(const QModelIndex &index, int role) const override
QModelIndex indexFromLayer(QgsMapLayer *layer) const
indexFromLayer returns the model index for a given layer
Base class for all map layer types.
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
const QHash< int, QByteArray > & roleNames() const
bool setData(const QModelIndex &index, const QVariant &value, int role) override
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.
QgsMapLayer::LayerType type() const
Get the type of the layer.
void addLayers(const QList< QgsMapLayer *> &layers)
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)
QString id() const
Get this layer's unique ID, this ID is used to access this layer from map layer registry.
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()
LayerType
Layers enum defining the types of layers that can be added to a map.
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
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 QIcon & iconLine()
QString name
Read property of QString layerName.
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)