A specialization of QTreeView for manipulate layers. More...
#include <LayerItemView.h>
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::AbstractLayerPtr > | getAllLayers () const |
Returs all layers in the tree including folders. More... | |
std::list< te::map::AbstractLayerPtr > | getVisibleLayers () 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 | |
LayerViewMenuManager * | m_mnuMger |
Default popup handler. More... | |
LayerItemModel * | m_model |
Model to be used. More... | |
QObject * | m_outterFilter |
Popup handler defined outside the tree. More... | |
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.
Definition at line 73 of file LayerItemView.h.
te::qt::widgets::LayerItemView::LayerItemView | ( | QWidget * | parent = 0 | ) |
Constructor.
parent | Used by Qt for memory release. |
te::qt::widgets::LayerItemView::~LayerItemView | ( | ) |
Destructor.
void te::qt::widgets::LayerItemView::addAllLayerAction | ( | QAction * | act | ) |
Adds the action to the popup menu presented for all kinds of selected items.
act | Action to be added. |
void te::qt::widgets::LayerItemView::addFolder | ( | const std::string & | name, |
const QModelIndex & | idx | ||
) |
Adds a folder layer to the model.
name | Name of the folder. |
idx | Index 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.
act | Action 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.
act | Action 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.
layers | The list of layers to be added. |
idx | The index of the parent item wich the must be insert. |
idxPath | Unused. |
void te::qt::widgets::LayerItemView::addMultipleSelectionAction | ( | QAction * | act | ) |
Adds the action to the popup menu presented when there is multiple items selected.
act | Action 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.
act | Action 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.
act | Action 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.
act | Action 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.
act | Action to be added. |
|
signal |
Emited when user double clicks over an AbstractLayer.
layer | The layer that receives mouse double click 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.
model | The item model. |
parent | The parent of the index. |
l | The 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.
QObject* te::qt::widgets::LayerItemView::getMenuEventHandler | ( | ) | const |
Rerturns the current popup handler being used.
std::list<te::qt::widgets::TreeItem*> te::qt::widgets::LayerItemView::getSelectedItems | ( | ) | const |
std::list<te::map::AbstractLayerPtr> te::qt::widgets::LayerItemView::getVisibleLayers | ( | ) | const |
Returns just the visible layers. No folder layers are returned.
|
signal |
Emited when user double clicks over an Layer Grouping.
layer | The layer that receives mouse double click event. |
|
signal |
Emited when the order of the layers has changed.
|
protected |
void te::qt::widgets::LayerItemView::removeDelegate | ( | QStyledItemDelegate * | d | ) |
Removes the delegate from the tree.
d | Delegate to be removed. |
void te::qt::widgets::LayerItemView::removeItems | ( | const QModelIndexList & | idxs | ) |
Removes the items in the list.
idxs | List 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.
handler | The handler to be removed. |
void te::qt::widgets::LayerItemView::removeSelectedItems | ( | ) |
Removes the items that are selected.
|
signal |
Emited when the selection changes.
layers | The current selected layers. |
|
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.
layers | The 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.
obj | The new menu event handler. |
void te::qt::widgets::LayerItemView::updateChart | ( | const QModelIndex & | idx | ) |
Updates the chart item of the element.
idx | Index of the layer to add chart. |
void te::qt::widgets::LayerItemView::updateGrouping | ( | const QModelIndex & | idx | ) |
Updates the grouping item of the element.
idx | Index of the layer to add grouping. |
void te::qt::widgets::LayerItemView::updateLegend | ( | te::map::AbstractLayer * | l | ) |
updateLegend
l |
|
signal |
Emited when some item changes its visibility.
|
protected |
Default popup handler.
Definition at line 340 of file LayerItemView.h.
|
protected |
Model to be used.
Definition at line 339 of file LayerItemView.h.
|
protected |
Popup handler defined outside the tree.
Definition at line 341 of file LayerItemView.h.