#include <LayerTreeModel.h>
Signals | |
void | layerOrderChanged () |
void | visibilityChanged (const te::map::AbstractLayerPtr &layer) |
Public Member Functions | |
void | add (const te::map::AbstractLayerPtr &layer, AbstractTreeItem *parentItem=0) |
It adds a item layer to the list of item layers of the parent layer item. If the parent layer is not specified, the item layer is added as a top layer item. More... | |
bool | canFetchMore (const QModelIndex &parent) const |
It fetches more data for the given 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... | |
bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) |
It handles the data supplied by a drag and drop operation that ended with the given action. 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... | |
QModelIndex | getIndex (AbstractTreeItem *item) |
It gets the index that is associated to the given item. More... | |
te::qt::widgets::AbstractTreeItem * | getLayerItem (const te::map::AbstractLayerPtr &layer) |
It gets the layer item that is associated to the given layer. More... | |
const std::vector < te::qt::widgets::AbstractTreeItem * > & | getTopLayerItems () const |
It gets the top level layer items of the model. More... | |
const std::vector < te::map::AbstractLayerPtr > & | getTopLayers () const |
It gets the top level layers of the model. More... | |
bool | hasChildren (const QModelIndex &parent=QModelIndex()) const |
It checks if the given index has children. 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... | |
bool | insertRows (int row, int count, const QModelIndex &parent=QModelIndex()) |
It inserts a determined number of rows given by the "count" parameter, starting with the given row under the parent "parent" from the model. More... | |
bool | isCheckable () const |
It verifies if the model items are checkable or not. More... | |
LayerTreeModel (QObject *parent=0) | |
It constructs a layer tree model with the given parent. More... | |
LayerTreeModel (const std::list< te::map::AbstractLayerPtr > &layers, QObject *parent=0) | |
It constructs a layer tree model with the given parent. More... | |
QMimeData * | mimeData (const QModelIndexList &indexes) const |
It returns an object that contains serialized items of data corresponding to the list of indexes specified. The formats used to describe the encoded data is obtained from the mimeTypes() function. More... | |
QStringList | mimeTypes () const |
It returns a list of MIME types that can be used to describe a list of model indexes. More... | |
QModelIndex | parent (const QModelIndex &index) const |
It returns the item parent of the given index, or QModelIndex(), if it has no parent. More... | |
bool | remove (AbstractTreeItem *item) |
It removes a item from the model. More... | |
bool | removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) |
It removes a determined number of rows given by the "count" parameter, starting with the given row under parent "parent" from the model. More... | |
int | rowCount (const QModelIndex &parent=QModelIndex()) const |
It returns the number of rows of the given parent. More... | |
void | set (const std::list< te::map::AbstractLayerPtr > &layers) |
It resets the model and associates the new top level items to the given top level layers. More... | |
void | setCheckable (const bool checkable) |
It sets the model items as checkable or not. 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... | |
Qt::DropActions | supportedDropActions () const |
It returns the drop actions supported by this model. More... | |
~LayerTreeModel () | |
Protected Member Functions | |
void | emitDataChangedForAncestors (const QModelIndex &index) |
It emits the dataChanged signal for the indexes that are ancestors of the given index. More... | |
void | emitDataChangedForDescendants (const QModelIndex &parent) |
It emits the dataChanged signal for the descendants indexes of the given index. More... | |
void | removeLayerFromParentChildrenList (std::vector< te::map::AbstractLayerPtr > &layers) |
It removes the given layers from the list of children of their parents. More... | |
Private Attributes | |
bool | m_checkable |
It informs if the model is checkable. More... | |
std::vector < te::map::AbstractLayerPtr > | m_insertingLayers |
The list of layers to be inserted. More... | |
std::vector< AbstractTreeItem * > | m_items |
The list of top level items. More... | |
std::vector < te::map::AbstractLayerPtr > | m_layers |
The list of top level layers. More... | |
Definition at line 47 of file LayerTreeModel.h.
te::qt::widgets::LayerTreeModel::LayerTreeModel | ( | QObject * | parent = 0 | ) |
It constructs a layer tree model with the given parent.
parent | The parent object of the layer tree model. |
Definition at line 41 of file LayerTreeModel.cpp.
te::qt::widgets::LayerTreeModel::LayerTreeModel | ( | const std::list< te::map::AbstractLayerPtr > & | layers, |
QObject * | parent = 0 |
||
) |
It constructs a layer tree model with the given parent.
layers | The layers that will be associated to the layer items of the layer tree model. |
parent | The parent object of the layer tree model. |
Definition at line 48 of file LayerTreeModel.cpp.
te::qt::widgets::LayerTreeModel::~LayerTreeModel | ( | ) |
void te::qt::widgets::LayerTreeModel::add | ( | const te::map::AbstractLayerPtr & | layer, |
AbstractTreeItem * | parentItem = 0 |
||
) |
It adds a item layer to the list of item layers of the parent layer item. If the parent layer is not specified, the item layer is added as a top layer item.
layer | The layer that will be associated to the item layer to be added. |
parentItem | The parent item where the layer item will be added. |
Definition at line 650 of file LayerTreeModel.cpp.
bool te::qt::widgets::LayerTreeModel::canFetchMore | ( | const QModelIndex & | parent | ) | const |
It fetches more data for the given parent.
parent | The object used to fetch more data. |
Definition at line 93 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::canFetchMore().
int te::qt::widgets::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 116 of file LayerTreeModel.cpp.
QVariant te::qt::widgets::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 222 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::data().
bool te::qt::widgets::LayerTreeModel::dropMimeData | ( | const QMimeData * | data, |
Qt::DropAction | action, | ||
int | row, | ||
int | column, | ||
const QModelIndex & | parent | ||
) |
It handles the data supplied by a drag and drop operation that ended with the given action.
data | The object containing serialized items of data. |
action | The action associated by the drag and drop operation. |
row | The item row in the model where the operation ended. |
column | The item column in the model where the operation ended. |
parent | The item parent in the model where the operation ended. |
Definition at line 315 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::getLayer(), and te::qt::widgets::AbstractTreeItem::hasChildren().
|
protected |
It emits the dataChanged signal for the indexes that are ancestors of the given index.
index | The item index whose ancestors will have the dataChanged signal emitted. |
Definition at line 741 of file LayerTreeModel.cpp.
|
protected |
It emits the dataChanged signal for the descendants indexes of the given index.
parent | The item index whose descendants will have the dataChanged signal emitted. |
Definition at line 723 of file LayerTreeModel.cpp.
void te::qt::widgets::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 103 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::fetchMore(), and TR_QT_WIDGETS.
Qt::ItemFlags te::qt::widgets::LayerTreeModel::flags | ( | const QModelIndex & | index | ) | const |
It returns the item flags for the given index.
index | The item index. |
Definition at line 209 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::flags(), and TR_QT_WIDGETS.
QModelIndex te::qt::widgets::LayerTreeModel::getIndex | ( | AbstractTreeItem * | item | ) |
It gets the index that is associated to the given item.
item | The item whose index will be returned. |
Definition at line 569 of file LayerTreeModel.cpp.
te::qt::widgets::AbstractTreeItem * te::qt::widgets::LayerTreeModel::getLayerItem | ( | const te::map::AbstractLayerPtr & | layer | ) |
It gets the layer item that is associated to the given layer.
layer | The layer whose the corresponding layer item will be returned. |
Definition at line 597 of file LayerTreeModel.cpp.
const std::vector< te::qt::widgets::AbstractTreeItem * > & te::qt::widgets::LayerTreeModel::getTopLayerItems | ( | ) | const |
It gets the top level layer items of the model.
layers | The top level layer items of the model. |
Definition at line 88 of file LayerTreeModel.cpp.
const std::vector< te::map::AbstractLayerPtr > & te::qt::widgets::LayerTreeModel::getTopLayers | ( | ) | const |
It gets the top level layers of the model.
layers | The top level layers of the model. |
Definition at line 83 of file LayerTreeModel.cpp.
bool te::qt::widgets::LayerTreeModel::hasChildren | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
It checks if the given index has children.
parent | The item index. |
Definition at line 266 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::hasChildren(), and TR_QT_WIDGETS.
QModelIndex te::qt::widgets::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 134 of file LayerTreeModel.cpp.
References TR_QT_WIDGETS.
bool te::qt::widgets::LayerTreeModel::insertRows | ( | int | row, |
int | count, | ||
const QModelIndex & | parent = QModelIndex() |
||
) |
It inserts a determined number of rows given by the "count" parameter, starting with the given row under the parent "parent" from the model.
row | The initial row. |
count | The number of rows to be inserted. |
parent | The parent of the rows to be inserted. |
Definition at line 450 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItemFactory::make().
bool te::qt::widgets::LayerTreeModel::isCheckable | ( | ) | const |
It verifies if the model items are checkable or not.
Definition at line 564 of file LayerTreeModel.cpp.
Referenced by te::qt::widgets::LayerTreeView::onItemClicked().
|
signal |
QMimeData * te::qt::widgets::LayerTreeModel::mimeData | ( | const QModelIndexList & | indexes | ) | const |
It returns an object that contains serialized items of data corresponding to the list of indexes specified. The formats used to describe the encoded data is obtained from the mimeTypes() function.
indexes | The list of indexes that was dragged. |
Definition at line 293 of file LayerTreeModel.cpp.
QStringList te::qt::widgets::LayerTreeModel::mimeTypes | ( | ) | const |
It returns a list of MIME types that can be used to describe a list of model indexes.
Definition at line 279 of file LayerTreeModel.cpp.
QModelIndex te::qt::widgets::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 166 of file LayerTreeModel.cpp.
References TR_QT_WIDGETS.
bool te::qt::widgets::LayerTreeModel::remove | ( | AbstractTreeItem * | item | ) |
It removes a item from the model.
item | The item to be removed from the model. |
Definition at line 673 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::getLayer().
|
protected |
It removes the given layers from the list of children of their parents.
layers | The layers that will be removed from the list of children of their parents. |
Definition at line 702 of file LayerTreeModel.cpp.
References te::common::TreeItem::remove().
bool te::qt::widgets::LayerTreeModel::removeRows | ( | int | row, |
int | count, | ||
const QModelIndex & | parent = QModelIndex() |
||
) |
It removes a determined number of rows given by the "count" parameter, starting with the given row under parent "parent" from the model.
row | The initial row. |
count | The number of rows to be removed. |
parent | The parent of the rows to be removed. |
Definition at line 507 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::getLayer().
int te::qt::widgets::LayerTreeModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
It returns the number of rows of the given parent.
parent | The parent index. |
Definition at line 121 of file LayerTreeModel.cpp.
References TR_QT_WIDGETS.
void te::qt::widgets::LayerTreeModel::set | ( | const std::list< te::map::AbstractLayerPtr > & | layers | ) |
It resets the model and associates the new top level items to the given top level layers.
layers | The list of top level layers that will be associated to the new top level items. |
Definition at line 60 of file LayerTreeModel.cpp.
References te::common::FreeContents(), and te::qt::widgets::AbstractTreeItemFactory::make().
void te::qt::widgets::LayerTreeModel::setCheckable | ( | const bool | checkable | ) |
It sets the model items as checkable or not.
checkable | Flag that indicates if the model items are checkable. |
Definition at line 559 of file LayerTreeModel.cpp.
Referenced by te::qt::widgets::LayerExplorer::LayerExplorer().
bool te::qt::widgets::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 238 of file LayerTreeModel.cpp.
References te::qt::widgets::AbstractTreeItem::setData().
Qt::DropActions te::qt::widgets::LayerTreeModel::supportedDropActions | ( | ) | const |
It returns the drop actions supported by this model.
Definition at line 288 of file LayerTreeModel.cpp.
|
signal |
|
private |
It informs if the model is checkable.
Definition at line 338 of file LayerTreeModel.h.
|
private |
The list of layers to be inserted.
Definition at line 337 of file LayerTreeModel.h.
|
private |
The list of top level items.
Definition at line 335 of file LayerTreeModel.h.
|
private |
The list of top level layers.
Definition at line 336 of file LayerTreeModel.h.