OGS
ElementTreeView Class Reference

Detailed Description

A TreeView to display mesh element properties.

Definition at line 23 of file ElementTreeView.h.

#include <ElementTreeView.h>

Inheritance diagram for ElementTreeView:
[legend]
Collaboration diagram for ElementTreeView:
[legend]

Public Slots

void updateView ()
 

Signals

void nodeSelected (vtkUnstructuredGridAlgorithm const *const, unsigned, bool)
 
void removeSelectedMeshComponent ()
 

Public Member Functions

 ElementTreeView (QWidget *parent=nullptr)
 Constructor.
 

Protected Slots

void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected) override
 Is called when the selection of this view changes.
 

Constructor & Destructor Documentation

◆ ElementTreeView()

ElementTreeView::ElementTreeView ( QWidget * parent = nullptr)
explicit

Constructor.

Definition at line 23 of file ElementTreeView.cpp.

23: QTreeView(parent) {}

Member Function Documentation

◆ nodeSelected

void ElementTreeView::nodeSelected ( vtkUnstructuredGridAlgorithm const * const ,
unsigned ,
bool  )
signal

Referenced by selectionChanged().

◆ removeSelectedMeshComponent

void ElementTreeView::removeSelectedMeshComponent ( )
signal

Referenced by selectionChanged().

◆ selectionChanged

void ElementTreeView::selectionChanged ( const QItemSelection & selected,
const QItemSelection & deselected )
overrideprotectedslot

Is called when the selection of this view changes.

Definition at line 38 of file ElementTreeView.cpp.

40{
41 Q_UNUSED(deselected);
42 if (!selected.isEmpty())
43 {
45 const QModelIndex idx = *(selected.indexes().begin());
46
47 if (idx.parent().isValid())
48 { // not root node
49 if (idx.parent().parent().isValid()) // not property node
50 {
51 const TreeItem* tree_item =
52 static_cast<TreeModel*>(this->model())->getItem(idx);
53 const unsigned node_index =
54 tree_item->data(0).toString().mid(5).toUInt();
55 emit nodeSelected(
56 static_cast<ElementTreeModel*>(this->model())->getSource(),
57 node_index, false);
58 }
59 }
60 }
61}
A model for the display of information concerning element information implemented as a TreeModel.
void nodeSelected(vtkUnstructuredGridAlgorithm const *const, unsigned, bool)
void removeSelectedMeshComponent()
Objects nodes for the TreeModel.
Definition TreeItem.h:28
virtual QVariant data(int column) const
Definition TreeItem.cpp:94
A hierarchical model for a tree implemented as a double-linked list.
Definition TreeModel.h:30

References TreeItem::data(), nodeSelected(), and removeSelectedMeshComponent().

◆ updateView

void ElementTreeView::updateView ( )
slot

Definition at line 25 of file ElementTreeView.cpp.

26{
27 setAlternatingRowColors(true);
28 setColumnWidth(0, 150);
29 std::size_t nColumns =
30 (this->model() != nullptr) ? this->model()->columnCount() : 0;
31 for (std::size_t i = 1; i < nColumns; i++)
32 {
33 resizeColumnToContents(i);
34 }
35 this->expandAll();
36}

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