All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
te::vp::LayerTreeModel Class Reference

#include <LayerTreeModel.h>

Inheritance diagram for te::vp::LayerTreeModel:

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...
 

Detailed Description

Definition at line 44 of file LayerTreeModel.h.

Constructor & Destructor Documentation

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.

Parameters
layersThe layers which will be associated to the model indexes.
parentThe parent object.

Definition at line 33 of file LayerTreeModel.cpp.

References m_items.

te::vp::LayerTreeModel::~LayerTreeModel ( )

Destructor

Definition at line 46 of file LayerTreeModel.cpp.

References te::common::FreeContents().

Member Function Documentation

bool te::vp::LayerTreeModel::canFetchMore ( const QModelIndex &  parent) const

It fetches more data for parent.

Parameters
parentThe object used to fetch more data.
Returns
It returns true if there is more data available for parent.

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.

Parameters
parentThe parent index.
Returns
The number of columns for the children of the given parent.

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.

Parameters
indexThe item index.
roleThe role that is used by the view to indicate to the model which type of data it needs.
Returns
The data stored under the given role for the item referred to by the index.

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.

Parameters
parentThe 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.

Parameters
indexThe item index.
Returns
The item flags for the given 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.

Returns
It returns a map of Layers end Properties selected.

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.

Parameters
parentThe item index.
Returns
It returns true if the given index has children.

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.

Parameters
sectionThe section number corresponds to the column number.
orientationThis type is used to signify an object's orientation.
roleThe role used.
Returns
The data for the given role and section in the header with the specified orientation.

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.

Parameters
rowThe item row.
columnThe item column.
parentThe parent index of the item.
Returns
The item index.

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.

Parameters
indexThe item index.
Returns
The parent index of the item with the given index, or QModelIndex(), if it has no parent.

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.

Parameters
parentThe parent index.
Returns
The number of rows of the given parent.

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.

Parameters
indexThe item index.
valueThe value to be assigned to the item.
roleThe role used.
Returns
It returns true if successful; otherwise, it returns false.
Note
The dataChanged() signal is emitted if the data was successfully set.

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.

Member Data Documentation

std::vector<te::qt::widgets::AbstractTreeItem*> te::vp::LayerTreeModel::m_items
private

Definition at line 181 of file LayerTreeModel.h.

Referenced by LayerTreeModel().

bool te::vp::LayerTreeModel::m_singleSelection
private

If is single selection or multiselection.

Definition at line 182 of file LayerTreeModel.h.


The documentation for this class was generated from the following files: