The QgsMapLayerModel class is a model to display layers in widgets.
More...
#include <qgsmaplayermodel.h>
Public Member Functions |
| QgsMapLayerModel (QObject *parent=0) |
| QgsMapLayerModel creates a model to display layers in widgets.
|
| QgsMapLayerModel (QList< QgsMapLayer * > layers, QObject *parent=0) |
| QgsMapLayerModel creates a model to display a specific list of layers in a widget.
|
void | checkAll (Qt::CheckState checkState) |
| checkAll changes the checkstate for all the layers
|
int | columnCount (const QModelIndex &parent) const override |
QVariant | data (const QModelIndex &index, int role) const override |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
QModelIndex | indexFromLayer (QgsMapLayer *layer) const |
| indexFromLayer returns the model index for a given layer
|
bool | itemsCheckable () const |
| returns if the items can be checked or not
|
QList< QgsMapLayer * > | layersChecked (Qt::CheckState checkState=Qt::Checked) |
| layersChecked returns the list of layers which are checked (or unchecked)
|
QModelIndex | parent (const QModelIndex &child) const override |
int | rowCount (const QModelIndex &parent) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
void | setItemsCheckable (bool checkable) |
| setItemsCheckable defines if layers should be selectable in the widget
|
Static Public Attributes |
static const int | LayerIdRole = Qt::UserRole + 1 |
Detailed Description
The QgsMapLayerModel class is a model to display layers in widgets.
- See Also
- QgsMapLayerProxyModel to sort and/filter the layers
-
QgsFieldModel to combine in with a field selector.
- Note
- added in 2.3
Definition at line 32 of file qgsmaplayermodel.h.
Constructor & Destructor Documentation
QgsMapLayerModel::QgsMapLayerModel |
( |
QObject * |
parent = 0 | ) |
|
|
explicit |
QgsMapLayerModel::QgsMapLayerModel |
( |
QList< QgsMapLayer * > |
layers, |
|
|
QObject * |
parent = 0 |
|
) |
| |
|
explicit |
Member Function Documentation
void QgsMapLayerModel::addLayers |
( |
QList< QgsMapLayer * > |
layers | ) |
|
|
protectedslot |
void QgsMapLayerModel::checkAll |
( |
Qt::CheckState |
checkState | ) |
|
int QgsMapLayerModel::columnCount |
( |
const QModelIndex & |
parent | ) |
const |
|
override |
QVariant QgsMapLayerModel::data |
( |
const QModelIndex & |
index, |
|
|
int |
role |
|
) |
| const |
|
override |
Qt::ItemFlags QgsMapLayerModel::flags |
( |
const QModelIndex & |
index | ) |
const |
|
override |
QModelIndex QgsMapLayerModel::index |
( |
int |
row, |
|
|
int |
column, |
|
|
const QModelIndex & |
parent = QModelIndex() |
|
) |
| const |
|
override |
QModelIndex QgsMapLayerModel::indexFromLayer |
( |
QgsMapLayer * |
layer | ) |
const |
bool QgsMapLayerModel::itemsCheckable |
( |
| ) |
const |
|
inline |
QList< QgsMapLayer * > QgsMapLayerModel::layersChecked |
( |
Qt::CheckState |
checkState = Qt::Checked | ) |
|
layersChecked returns the list of layers which are checked (or unchecked)
Definition at line 60 of file qgsmaplayermodel.cpp.
QModelIndex QgsMapLayerModel::parent |
( |
const QModelIndex & |
child | ) |
const |
|
override |
void QgsMapLayerModel::removeLayers |
( |
const QStringList |
layerIds | ) |
|
|
protectedslot |
int QgsMapLayerModel::rowCount |
( |
const QModelIndex & |
parent | ) |
const |
|
override |
bool QgsMapLayerModel::setData |
( |
const QModelIndex & |
index, |
|
|
const QVariant & |
value, |
|
|
int |
role |
|
) |
| |
|
override |
void QgsMapLayerModel::setItemsCheckable |
( |
bool |
checkable | ) |
|
setItemsCheckable defines if layers should be selectable in the widget
Definition at line 46 of file qgsmaplayermodel.cpp.
Member Data Documentation
const int QgsMapLayerModel::LayerIdRole = Qt::UserRole + 1 |
|
static |
bool QgsMapLayerModel::mItemCheckable |
|
protected |
QMap<QString, Qt::CheckState> QgsMapLayerModel::mLayersChecked |
|
protected |
The documentation for this class was generated from the following files: