QGIS API Documentation
2.4.0-Chugiak
|
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. More... | |
QgsMapLayerModel (QList< QgsMapLayer * > layers, QObject *parent=0) | |
QgsMapLayerModel creates a model to display a specific list of layers in a widget. More... | |
void | setItemsCheckable (bool checkable) |
setItemsCheckable defines if layers should be selectable in the widget More... | |
void | checkAll (Qt::CheckState checkState) |
checkAll changes the checkstate for all the layers More... | |
QList< QgsMapLayer * > | layersChecked (Qt::CheckState checkState=Qt::Checked) |
layersChecked returns the list of layers which are checked (or unchecked) More... | |
bool | itemsCheckable () |
returns if the items can be checked or not More... | |
QModelIndex | indexFromLayer (QgsMapLayer *layer) |
indexFromLayer returns the model index for a given layer More... | |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const |
QModelIndex | parent (const QModelIndex &child) const |
int | rowCount (const QModelIndex &parent) const |
int | columnCount (const QModelIndex &parent) const |
QVariant | data (const QModelIndex &index, int role) const |
bool | setData (const QModelIndex &index, const QVariant &value, int role) |
Qt::ItemFlags | flags (const QModelIndex &index) const |
Static Public Attributes | |
static const int | LayerIdRole = Qt::UserRole + 1 |
Protected Slots | |
void | removeLayers (const QStringList layerIds) |
void | addLayers (QList< QgsMapLayer * > layers) |
Protected Attributes | |
QList< QgsMapLayer * > | mLayers |
QMap< QString, Qt::CheckState > | mLayersChecked |
bool | mItemCheckable |
The QgsMapLayerModel class is a model to display layers in widgets.
Definition at line 32 of file qgsmaplayermodel.h.
|
explicit |
QgsMapLayerModel creates a model to display layers in widgets.
Definition at line 35 of file qgsmaplayermodel.cpp.
References addLayers(), QgsMapLayerRegistry::instance(), and removeLayers().
|
explicit |
QgsMapLayerModel creates a model to display a specific list of layers in a widget.
Definition at line 26 of file qgsmaplayermodel.cpp.
References addLayers(), QgsMapLayerRegistry::instance(), and removeLayers().
|
protectedslot |
Definition at line 95 of file qgsmaplayermodel.cpp.
References QgsMapLayer::id(), mLayers, and mLayersChecked.
Referenced by QgsMapLayerModel().
void QgsMapLayerModel::checkAll | ( | Qt::CheckState | checkState | ) |
checkAll changes the checkstate for all the layers
Definition at line 50 of file qgsmaplayermodel.cpp.
References index(), mLayers, and mLayersChecked.
int QgsMapLayerModel::columnCount | ( | const QModelIndex & | parent | ) | const |
Definition at line 129 of file qgsmaplayermodel.cpp.
QVariant QgsMapLayerModel::data | ( | const QModelIndex & | index, |
int | role | ||
) | const |
Definition at line 135 of file qgsmaplayermodel.cpp.
References QgsVectorLayer::geometryType(), QgsApplication::getThemeIcon(), QgsMapLayer::id(), LayerIdRole, QGis::Line, mItemCheckable, mLayersChecked, QgsMapLayer::name(), QGis::NoGeometry, QGis::Point, QGis::Polygon, QgsMapLayer::RasterLayer, QgsMapLayer::type(), and QgsMapLayer::VectorLayer.
Qt::ItemFlags QgsMapLayerModel::flags | ( | const QModelIndex & | index | ) | const |
Definition at line 215 of file qgsmaplayermodel.cpp.
References mItemCheckable.
QModelIndex QgsMapLayerModel::index | ( | int | row, |
int | column, | ||
const QModelIndex & | parent = QModelIndex() |
||
) | const |
Definition at line 106 of file qgsmaplayermodel.cpp.
References mLayers.
Referenced by checkAll(), indexFromLayer(), and removeLayers().
QModelIndex QgsMapLayerModel::indexFromLayer | ( | QgsMapLayer * | layer | ) |
indexFromLayer returns the model index for a given layer
Definition at line 72 of file qgsmaplayermodel.cpp.
References index(), and mLayers.
Referenced by QgsMapLayerComboBox::setLayer().
|
inline |
returns if the items can be checked or not
Definition at line 60 of file qgsmaplayermodel.h.
QList< QgsMapLayer * > QgsMapLayerModel::layersChecked | ( | Qt::CheckState | checkState = Qt::Checked | ) |
layersChecked returns the list of layers which are checked (or unchecked)
Definition at line 59 of file qgsmaplayermodel.cpp.
References QgsMapLayer::id(), mLayers, and mLayersChecked.
QModelIndex QgsMapLayerModel::parent | ( | const QModelIndex & | child | ) | const |
Definition at line 117 of file qgsmaplayermodel.cpp.
|
protectedslot |
Definition at line 78 of file qgsmaplayermodel.cpp.
References index(), LayerIdRole, mLayers, and mLayersChecked.
Referenced by QgsMapLayerModel().
int QgsMapLayerModel::rowCount | ( | const QModelIndex & | parent | ) | const |
Definition at line 124 of file qgsmaplayermodel.cpp.
References mLayers.
bool QgsMapLayerModel::setData | ( | const QModelIndex & | index, |
const QVariant & | value, | ||
int | role | ||
) |
Definition at line 231 of file qgsmaplayermodel.cpp.
References QgsMapLayer::id(), and mLayersChecked.
void QgsMapLayerModel::setItemsCheckable | ( | bool | checkable | ) |
setItemsCheckable defines if layers should be selectable in the widget
Definition at line 45 of file qgsmaplayermodel.cpp.
References mItemCheckable.
|
static |
Definition at line 36 of file qgsmaplayermodel.h.
Referenced by data(), and removeLayers().
|
protected |
Definition at line 75 of file qgsmaplayermodel.h.
Referenced by data(), flags(), and setItemsCheckable().
|
protected |
Definition at line 73 of file qgsmaplayermodel.h.
Referenced by addLayers(), checkAll(), index(), indexFromLayer(), layersChecked(), removeLayers(), and rowCount().
|
protected |
Definition at line 74 of file qgsmaplayermodel.h.
Referenced by addLayers(), checkAll(), data(), layersChecked(), removeLayers(), and setData().