OGS
|
A hierarchical model for a tree implemented as a double-linked list.
A hierarchical model for the pre-defined QTreeView included in QT. The tree as implemented as a double-linked list.
Definition at line 29 of file TreeModel.h.
#include <TreeModel.h>
Public Slots | |
void | updateData () |
Public Member Functions | |
TreeModel (QObject *parent=nullptr) | |
~TreeModel () override | |
QVariant | data (const QModelIndex &index, int role) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
TreeItem * | getItem (const QModelIndex &index) const |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
QModelIndex | parent (const QModelIndex &index) const override |
bool | removeRows (int position, int count, const QModelIndex &parent) override |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
TreeItem * | rootItem () const |
Protected Attributes | |
TreeItem * | _rootItem |
Private Member Functions | |
void | setupModelData (const QStringList &lines, TreeItem *parent) |
|
explicit |
A model for the QTreeView implementing the tree as a double-linked list.
Definition at line 26 of file TreeModel.cpp.
References _rootItem.
|
override |
|
override |
Determines how many columns are present for a given model index.
Definition at line 127 of file TreeModel.cpp.
References _rootItem, TreeItem::columnCount(), columnCount(), and parent().
Referenced by columnCount().
|
override |
Since each item manages its own columns, the column number is used to retrieve the data with the TreeItem::data() function
Definition at line 142 of file TreeModel.cpp.
References TreeItem::data(), and index().
Referenced by GeoTreeModel::removeGeoList(), StationTreeModel::vtkSource(), and GeoTreeModel::vtkSource().
|
override |
Definition at line 175 of file TreeModel.cpp.
References index().
TreeItem * TreeModel::getItem | ( | const QModelIndex & | index | ) | const |
Returns the Item characterized by the given index.
Definition at line 188 of file TreeModel.cpp.
References _rootItem, and index().
Referenced by VtkAddFilterDialog::VtkAddFilterDialog(), VtkVisPipeline::addPipelineItem(), VtkVisPipeline::addPipelineItem(), MeshModel::getMesh(), VtkAddFilterDialog::on_buttonBox_accepted(), MeshModel::removeMesh(), removeRows(), VtkVisPipeline::removeSourceItem(), VtkVisPipeline::removeSourceItem(), VtkVisPipeline::removeSourceItem(), StationTreeModel::removeStationList(), and MeshModel::vtkSource().
|
override |
Definition at line 201 of file TreeModel.cpp.
References _rootItem, and TreeItem::data().
|
override |
Returns the index of a TreeItem given its parent and position. It is first checked if the model index is valid. If it is not, it is assumed that a top-level item is being referred to; otherwise, the data pointer from the model index is obtained with its internalPointer() function and is used to reference a TreeItem object
row | Row of the tree object |
column | Column of the tree object |
parent | Index of the parent object |
Definition at line 50 of file TreeModel.cpp.
References _rootItem, TreeItem::child(), and parent().
Referenced by AddFaultsToVoxelGridDialog::AddFaultsToVoxelGridDialog(), Layers2GridDialog::Layers2GridDialog(), TranslateDataDialog::TranslateDataDialog(), Vtu2GridDialog::Vtu2GridDialog(), MeshModel::addMeshObject(), VtkVisPipeline::addPipelineItem(), data(), flags(), VtkVisPipeline::flags(), getItem(), VtkVisPipeline::highlightGeoObject(), VtkVisPipeline::highlightMeshComponent(), parent(), GeoTreeModel::removeGeoList(), MeshModel::removeMesh(), VtkVisPipeline::removePipelineItem(), VtkVisPipeline::removeSourceItem(), VtkVisPipeline::removeSourceItem(), VtkVisPipeline::removeSourceItem(), setData(), VtkVisPipeline::setData(), and MeshModel::updateMesh().
|
override |
Returns the model index of a TreeItem based on its index.
Definition at line 81 of file TreeModel.cpp.
References _rootItem, index(), TreeItem::parentItem(), and TreeItem::row().
Referenced by ProcessModel::addConditionItem(), VtkVisPipeline::addPipelineItem(), VtkVisPipeline::addPipelineItem(), GeoTreeModel::appendPolylines(), GeoTreeModel::appendSurfaces(), columnCount(), MeshModel::columnCount(), ProcessModel::columnCount(), index(), StationTreeModel::index(), GeoTreeModel::removeGeoList(), removeRows(), StationTreeModel::removeStationList(), rowCount(), and setupModelData().
|
override |
Removes item from the model.
Definition at line 215 of file TreeModel.cpp.
References getItem(), parent(), and TreeItem::removeChildren().
Referenced by GeoTreeModel::removeGeoList(), VtkVisPipeline::removePipelineItem(), and StationTreeModel::removeStationList().
TreeItem * TreeModel::rootItem | ( | ) | const |
Definition at line 294 of file TreeModel.cpp.
References _rootItem.
Referenced by TreeModelIterator::TreeModelIterator(), and TreeModelIterator::next().
|
override |
Returns the number of child items for the TreeItem that corresponds to a given model index, or the number of top-level items if an invalid index is specified.
Definition at line 104 of file TreeModel.cpp.
References _rootItem, TreeItem::childCount(), and parent().
Referenced by AddFaultsToVoxelGridDialog::AddFaultsToVoxelGridDialog(), Layers2GridDialog::Layers2GridDialog(), TranslateDataDialog::TranslateDataDialog(), Vtu2GridDialog::Vtu2GridDialog(), and StationTreeModel::addStationList().
|
override |
Definition at line 159 of file TreeModel.cpp.
References index(), and TreeItem::setData().
Referenced by VtkVisPipeline::setData().
|
private |
Test method for creating a tree model
Definition at line 230 of file TreeModel.cpp.
References parent().
|
slot |
Definition at line 137 of file TreeModel.cpp.
|
protected |
Definition at line 58 of file TreeModel.h.
Referenced by ElementTreeModel::ElementTreeModel(), FemConditionModel::FemConditionModel(), GeoTreeModel::GeoTreeModel(), MeshModel::MeshModel(), ProcessModel::ProcessModel(), StationTreeModel::StationTreeModel(), TreeModel(), VtkVisPipeline::VtkVisPipeline(), ~TreeModel(), MeshModel::addMeshObject(), VtkVisPipeline::addPipelineItem(), GeoTreeModel::addPointList(), GeoTreeModel::addPolylineList(), ProcessModel::addProcessVar(), StationTreeModel::addStationList(), GeoTreeModel::addSurfaceList(), ProcessModel::clearModel(), ElementTreeModel::clearView(), FemConditionModel::clearView(), columnCount(), getItem(), MeshModel::getMesh(), ProcessModel::getProcessVarItem(), headerData(), VtkVisPipeline::highlightGeoObject(), VtkVisPipeline::highlightMeshComponent(), index(), StationTreeModel::index(), parent(), MeshModel::removeMesh(), ProcessModel::removeProcessVariable(), VtkVisPipeline::removeSourceItem(), VtkVisPipeline::removeSourceItem(), VtkVisPipeline::removeSourceItem(), rootItem(), rowCount(), ElementTreeModel::setElement(), FemConditionModel::setFemCondition(), VtkVisPipeline::setGlobalBackfaceCulling(), VtkVisPipeline::setGlobalSuperelevation(), ElementTreeModel::setMesh(), FemConditionModel::setProcessVariable(), VtkVisPipeline::showMeshElementQuality(), MeshModel::updateMesh(), and MeshModel::vtkSource().