#include <LayerTreeModel.h>
Public Member Functions | |
bool | canFetchMore (const QModelIndex &parent) const |
It fetches more data for parent. More... | |
int | columnCount (const QModelIndex &parent=QModelIndex()) const |
It returns the number of columns for the children of the given parent. More... | |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
It returns the data stored under the given role for the item referred to by the index. More... | |
void | fetchMore (const QModelIndex &parent) |
It fetches any available data for the items with the parent specified by the parent index. More... | |
Qt::ItemFlags | flags (const QModelIndex &index) const |
It returns the item flags for the given index. More... | |
std::map < te::map::AbstractLayerPtr, std::vector< te::dt::Property * > > | getSelected () |
It get the Layer selected and the Properties selected of the Layer. More... | |
bool | hasChildren (const QModelIndex &parent=QModelIndex()) const |
It checks if the given index has children. More... | |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
Returns the data for the given role and section in the header with the specified orientation. More... | |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const |
It returns the index of the item in the model specified by the given row, column and parent index. More... | |
LayerTreeModel (const std::list< te::map::AbstractLayerPtr > &layers, bool singleSelection=false, QObject *parent=0) | |
It constructs an item model with the given parent. More... | |
QModelIndex | parent (const QModelIndex &index) const |
It returns the item parent of the given index, or QModelIndex(), if it has no parent. More... | |
int | rowCount (const QModelIndex &parent=QModelIndex()) const |
It returns the number of rows of the given parent. More... | |
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) |
It sets the role data for the item at index to value. More... | |
void | setLayerList (const std::list< te::map::AbstractLayerPtr > &layers) |
~LayerTreeModel () | |
Private Attributes | |
std::vector < te::qt::widgets::AbstractTreeItem * > | m_items |
bool | m_singleSelection |
If is single selection or multiselection. More... | |
Definition at line 44 of file LayerTreeModel.h.
te::vp::LayerTreeModel::LayerTreeModel | ( | const std::list< te::map::AbstractLayerPtr > & | layers, |
bool | singleSelection = false , |
||
QObject * | parent = 0 |
||
) |
It constructs an item model with the given parent.
layers | The layers which will be associated to the model indexes. |
parent | The parent object. |
Definition at line 33 of file LayerTreeModel.cpp.
References m_items.
te::vp::LayerTreeModel::~LayerTreeModel | ( | ) |
bool te::vp::LayerTreeModel::canFetchMore | ( | const QModelIndex & | parent | ) | const |
It fetches more data for parent.
parent | The object used to fetch more data. |
Definition at line 51 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::canFetchMore().
int te::vp::LayerTreeModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
It returns the number of columns for the children of the given parent.
parent | The parent index. |
Definition at line 61 of file LayerTreeModel.cpp.
QVariant te::vp::LayerTreeModel::data | ( | const QModelIndex & | index, |
int | role = Qt::DisplayRole |
||
) | const |
It returns the data stored under the given role for the item referred to by the index.
index | The item index. |
role | The role that is used by the view to indicate to the model which type of data it needs. |
Definition at line 66 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::data().
void te::vp::LayerTreeModel::fetchMore | ( | const QModelIndex & | parent | ) |
It fetches any available data for the items with the parent specified by the parent index.
parent | The object used to fetch available data. |
Definition at line 79 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::fetchMore(), and TE_TR.
Qt::ItemFlags te::vp::LayerTreeModel::flags | ( | const QModelIndex & | index | ) | const |
It returns the item flags for the given index.
index | The item index. |
Definition at line 92 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::flags(), and TE_TR.
std::map< te::map::AbstractLayerPtr, std::vector< te::dt::Property * > > te::vp::LayerTreeModel::getSelected | ( | ) |
It get the Layer selected and the Properties selected of the Layer.
Definition at line 282 of file LayerTreeModel.cpp.
References te::vp::LayerItem::getLayer(), te::vp::LayerItem::getSelected(), and te::vp::LayerItem::isSelected().
bool te::vp::LayerTreeModel::hasChildren | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
It checks if the given index has children.
parent | The item index. |
Definition at line 105 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::hasChildren(), and TE_TR.
QVariant te::vp::LayerTreeModel::headerData | ( | int | section, |
Qt::Orientation | orientation, | ||
int | role = Qt::DisplayRole |
||
) | const |
Returns the data for the given role and section in the header with the specified orientation.
section | The section number corresponds to the column number. |
orientation | This type is used to signify an object's orientation. |
role | The role used. |
Definition at line 266 of file LayerTreeModel.cpp.
References TE_TR.
QModelIndex te::vp::LayerTreeModel::index | ( | int | row, |
int | column, | ||
const QModelIndex & | parent = QModelIndex() |
||
) | const |
It returns the index of the item in the model specified by the given row, column and parent index.
It will call createIndex() to generate model indexes that other components can use to refer to items in the model.
row | The item row. |
column | The item column. |
parent | The parent index of the item. |
Definition at line 118 of file LayerTreeModel.cpp.
References TE_TR.
QModelIndex te::vp::LayerTreeModel::parent | ( | const QModelIndex & | index | ) | const |
It returns the item parent of the given index, or QModelIndex(), if it has no parent.
index | The item index. |
Definition at line 156 of file LayerTreeModel.cpp.
References TE_TR.
int te::vp::LayerTreeModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
It returns the number of rows of the given parent.
parent | The parent index. |
Definition at line 199 of file LayerTreeModel.cpp.
References TE_TR.
bool te::vp::LayerTreeModel::setData | ( | const QModelIndex & | index, |
const QVariant & | value, | ||
int | role = Qt::EditRole |
||
) |
It sets the role data for the item at index to value.
index | The item index. |
value | The value to be assigned to the item. |
role | The role used. |
Definition at line 212 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::getLayer(), te::vp::LayerItem::isSelected(), and te::qt::widgets::AbstractTreeItem::setData().
void te::vp::LayerTreeModel::setLayerList | ( | const std::list< te::map::AbstractLayerPtr > & | layers | ) |
Definition at line 299 of file LayerTreeModel.cpp.
|
private |
Definition at line 181 of file LayerTreeModel.h.
Referenced by LayerTreeModel().
|
private |
If is single selection or multiselection.
Definition at line 182 of file LayerTreeModel.h.