te::qt::widgets::LayerItemView Class Reference

A specialization of QTreeView for manipulate layers. More...

#include <LayerItemView.h>

Inheritance diagram for te::qt::widgets::LayerItemView:

Signals

Qt signals

Signals emitted by LayerItemView

void doubleClicked (te::map::AbstractLayerPtr layer)
 Emited when user double clicks over an AbstractLayer. More...
 
void groupingDoubleClicked (te::map::AbstractLayerPtr layer)
 Emited when user double clicks over an Layer Grouping. More...
 
void visibilityChanged ()
 Emited when some item changes its visibility. More...
 
void selectedLayersChanged (const std::list< te::map::AbstractLayerPtr > &layers)
 Emited when the selection changes. More...
 
void layerOrderChanged ()
 Emited when the order of the layers has changed. More...
 

Public Member Functions

Initializer Methods

Methods related to instantiation and destruction.

 LayerItemView (QWidget *parent=0)
 Constructor. More...
 
 ~LayerItemView ()
 Destructor. More...
 
Tree manipulation Methods

Methods related insertions and recovery of layers in the tree.

void addLayers (const std::list< te::map::AbstractLayerPtr > &layers, const QModelIndex &idx, const std::string &idxPath="./")
 Add the layers to the model. More...
 
void setLayers (const std::list< te::map::AbstractLayerPtr > &layers)
 Sets the list of layers. Old layers in the tree are then removed. More...
 
std::list< te::map::AbstractLayerPtrgetAllLayers () const
 Returs all layers in the tree including folders. More...
 
std::list< te::map::AbstractLayerPtrgetVisibleLayers () const
 Returns just the visible layers. No folder layers are returned. More...
 
std::list< te::qt::widgets::TreeItem * > getSelectedItems () const
 Returns a list of TreeItem that are selected. More...
 
void addFolder (const std::string &name, const QModelIndex &idx)
 Adds a folder layer to the model. More...
 
void updateChart (const QModelIndex &idx)
 Updates the chart item of the element. More...
 
void updateGrouping (const QModelIndex &idx)
 Updates the grouping item of the element. More...
 
void updateLegend (te::map::AbstractLayer *l)
 updateLegend More...
 
Popup Menu manipulation Methods

Methods related to manipulation of the popup menus.

void addNoLayerAction (QAction *act)
 Adds the action to the popup menu presented when there is no layers selected. More...
 
void addAllLayerAction (QAction *act)
 Adds the action to the popup menu presented for all kinds of selected items. More...
 
void addVectorLayerAction (QAction *act)
 Adds the action to the popup menu presented when the selected layer has vector representation. More...
 
void addRasterLayerAction (QAction *act)
 Adds the action to the popup menu presented when the selected layer has raster representation. More...
 
void addTabularLayerAction (QAction *act)
 Adds the action to the popup menu presented when the selected layer has tabular representation. More...
 
void addFolderLayerAction (QAction *act)
 Adds the action to the popup menu presented when the selected item is a folder. More...
 
void addMultipleSelectionAction (QAction *act)
 Adds the action to the popup menu presented when there is multiple items selected. More...
 
void addInvalidLayerAction (QAction *act)
 Adds the action to the popup menu presented when the selected layer is invalid. More...
 
QModelIndex findLayerIndex (QAbstractItemModel *model, const QModelIndex &parent, te::map::AbstractLayer *l)
 Return the QModelIndex of the Layer in the Tree. More...
 
Remove Methods

Methods related to layers removal.

void removeItems (const QModelIndexList &idxs)
 Removes the items in the list. More...
 
void removeSelectedItems ()
 Removes the items that are selected. More...
 
Tree Customization Methods

Methods used to change the tree behavior.

These methods can be used for change the Tree presentation and popup menus. You can used delegates to change presentation behavior, and use QObject to handle popup menus.

void removeDelegate (QStyledItemDelegate *d)
 Removes the delegate from the tree. More...
 
void setMenuEventHandler (QObject *obj)
 Updates the popup event handler. More...
 
QObject * getMenuEventHandler () const
 Rerturns the current popup handler being used. More...
 
void removeMenuEventHandler (QObject *handler)
 Removes the menu handler. More...
 

Protected Member Functions

Qt Reimplemented Methods

Methods that are reimplemented of the QTreeView class.

void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected)
 
void dropEvent (QDropEvent *event)
 
void mouseDoubleClickEvent (QMouseEvent *event)
 

Protected Attributes

LayerViewMenuManagerm_mnuMger
 Default popup handler. More...
 
LayerItemModelm_model
 Model to be used. More...
 
QObject * m_outterFilter
 Popup handler defined outside the tree. More...
 

Detailed Description

A specialization of QTreeView for manipulate layers.

This is a component used to manipulate layers in a visual way. You can add, remove, reparent items, changes its visibility, add folders and some other operations over a set of layers. It can be feeded by the LayersSelector or projects of TerraLib-5.

See also
LayerItemModel, LayerViewDelegate, LayerViewMenuManager

Definition at line 73 of file LayerItemView.h.

Constructor & Destructor Documentation

te::qt::widgets::LayerItemView::LayerItemView ( QWidget *  parent = 0)

Constructor.

Parameters
parentUsed by Qt for memory release.
te::qt::widgets::LayerItemView::~LayerItemView ( )

Destructor.

Member Function Documentation

void te::qt::widgets::LayerItemView::addAllLayerAction ( QAction *  act)

Adds the action to the popup menu presented for all kinds of selected items.

Parameters
actAction to be added.
void te::qt::widgets::LayerItemView::addFolder ( const std::string &  name,
const QModelIndex &  idx 
)

Adds a folder layer to the model.

Parameters
nameName of the folder.
idxIndex of the parent, where the new folder must be inserted in.
void te::qt::widgets::LayerItemView::addFolderLayerAction ( QAction *  act)

Adds the action to the popup menu presented when the selected item is a folder.

Parameters
actAction to be added.
void te::qt::widgets::LayerItemView::addInvalidLayerAction ( QAction *  act)

Adds the action to the popup menu presented when the selected layer is invalid.

Parameters
actAction to be added.
void te::qt::widgets::LayerItemView::addLayers ( const std::list< te::map::AbstractLayerPtr > &  layers,
const QModelIndex &  idx,
const std::string &  idxPath = "./" 
)

Add the layers to the model.

Parameters
layersThe list of layers to be added.
idxThe index of the parent item wich the must be insert.
idxPathUnused.
void te::qt::widgets::LayerItemView::addMultipleSelectionAction ( QAction *  act)

Adds the action to the popup menu presented when there is multiple items selected.

Parameters
actAction to be added.
void te::qt::widgets::LayerItemView::addNoLayerAction ( QAction *  act)

Adds the action to the popup menu presented when there is no layers selected.

Parameters
actAction to be added.
void te::qt::widgets::LayerItemView::addRasterLayerAction ( QAction *  act)

Adds the action to the popup menu presented when the selected layer has raster representation.

Parameters
actAction to be added.
void te::qt::widgets::LayerItemView::addTabularLayerAction ( QAction *  act)

Adds the action to the popup menu presented when the selected layer has tabular representation.

Parameters
actAction to be added.
void te::qt::widgets::LayerItemView::addVectorLayerAction ( QAction *  act)

Adds the action to the popup menu presented when the selected layer has vector representation.

Parameters
actAction to be added.
void te::qt::widgets::LayerItemView::doubleClicked ( te::map::AbstractLayerPtr  layer)
signal

Emited when user double clicks over an AbstractLayer.

Parameters
layerThe layer that receives mouse double click event.
void te::qt::widgets::LayerItemView::dropEvent ( QDropEvent *  event)
protected
QModelIndex te::qt::widgets::LayerItemView::findLayerIndex ( QAbstractItemModel *  model,
const QModelIndex &  parent,
te::map::AbstractLayer l 
)

Return the QModelIndex of the Layer in the Tree.

Parameters
modelThe item model.
parentThe parent of the index.
lThe layer.
std::list<te::map::AbstractLayerPtr> te::qt::widgets::LayerItemView::getAllLayers ( ) const

Returs all layers in the tree including folders.

This method must be called when we need to store the list of layers.

Returns
List of layers in the tree.
QObject* te::qt::widgets::LayerItemView::getMenuEventHandler ( ) const

Rerturns the current popup handler being used.

Returns
Current menu event handler.
std::list<te::qt::widgets::TreeItem*> te::qt::widgets::LayerItemView::getSelectedItems ( ) const

Returns a list of TreeItem that are selected.

Returns
The list of selected TreeItem.
std::list<te::map::AbstractLayerPtr> te::qt::widgets::LayerItemView::getVisibleLayers ( ) const

Returns just the visible layers. No folder layers are returned.

Returns
List of visible layers.
void te::qt::widgets::LayerItemView::groupingDoubleClicked ( te::map::AbstractLayerPtr  layer)
signal

Emited when user double clicks over an Layer Grouping.

Parameters
layerThe layer that receives mouse double click event.
void te::qt::widgets::LayerItemView::layerOrderChanged ( )
signal

Emited when the order of the layers has changed.

void te::qt::widgets::LayerItemView::mouseDoubleClickEvent ( QMouseEvent *  event)
protected
void te::qt::widgets::LayerItemView::removeDelegate ( QStyledItemDelegate *  d)

Removes the delegate from the tree.

Parameters
dDelegate to be removed.
Note
The tree does NOT TAKE the ownership of the pointer.
void te::qt::widgets::LayerItemView::removeItems ( const QModelIndexList &  idxs)

Removes the items in the list.

Parameters
idxsList of indexes of items to be removed.
void te::qt::widgets::LayerItemView::removeMenuEventHandler ( QObject *  handler)

Removes the menu handler.

Removes the menu handler from the tree.

Parameters
handlerThe handler to be removed.
Note
The tree does NOT TAKE free memory of handler object.
void te::qt::widgets::LayerItemView::removeSelectedItems ( )

Removes the items that are selected.

void te::qt::widgets::LayerItemView::selectedLayersChanged ( const std::list< te::map::AbstractLayerPtr > &  layers)
signal

Emited when the selection changes.

Parameters
layersThe current selected layers.
void te::qt::widgets::LayerItemView::selectionChanged ( const QItemSelection &  selected,
const QItemSelection &  deselected 
)
protected
void te::qt::widgets::LayerItemView::setLayers ( const std::list< te::map::AbstractLayerPtr > &  layers)

Sets the list of layers. Old layers in the tree are then removed.

Parameters
layersThe new list of layers.
void te::qt::widgets::LayerItemView::setMenuEventHandler ( QObject *  obj)

Updates the popup event handler.

This is used for change the popup menus. If you want to change the popup management try to use this function. You can change all menu handling or a specific type of item.

Parameters
objThe new menu event handler.
Note
The tree does NOT TAKE the ownership of the pointer.
void te::qt::widgets::LayerItemView::updateChart ( const QModelIndex &  idx)

Updates the chart item of the element.

Parameters
idxIndex of the layer to add chart.
Note
idx must contain a Layer or the operation will fail.
void te::qt::widgets::LayerItemView::updateGrouping ( const QModelIndex &  idx)

Updates the grouping item of the element.

Parameters
idxIndex of the layer to add grouping.
Note
idx must contain a Layer or the operation will fail.
void te::qt::widgets::LayerItemView::updateLegend ( te::map::AbstractLayer l)

updateLegend

Parameters
l
void te::qt::widgets::LayerItemView::visibilityChanged ( )
signal

Emited when some item changes its visibility.

Member Data Documentation

LayerViewMenuManager* te::qt::widgets::LayerItemView::m_mnuMger
protected

Default popup handler.

Definition at line 340 of file LayerItemView.h.

LayerItemModel* te::qt::widgets::LayerItemView::m_model
protected

Model to be used.

Definition at line 339 of file LayerItemView.h.

QObject* te::qt::widgets::LayerItemView::m_outterFilter
protected

Popup handler defined outside the tree.

Definition at line 341 of file LayerItemView.h.


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