OGS
ProcessView Class Referencefinal

Detailed Description

A view for FEM-Conditions (Initial- & Boundary Conditions / Source Terms) with a number of additional information such as Process Type, Distribution, etc.

See also
ConditionModel, CondItem

Definition at line 29 of file ProcessView.h.

#include <ProcessView.h>

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

Signals

void itemSelectionChanged (QItemSelection const &selected, QItemSelection const &deselected)
 
void conditionRemoved (QString const &, QString const &)
 
void processVarRemoved (QString const &)
 
void clearConditionView ()
 
void processVarSelected (DataHolderLib::FemCondition *cond)
 
void conditionSelected (DataHolderLib::FemCondition *cond)
 

Public Member Functions

 ProcessView (QWidget *parent=nullptr)
 Constructor.
 
void updateView ()
 Update the view to visualise changes made to the underlying data.
 

Protected Slots

void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected) override
 Instructions if the selection of items in the view has changed.
 

Private Slots

void on_Clicked (QModelIndex idx)
 
void removeCondition ()
 
void removeProcessVar ()
 

Private Member Functions

void contextMenuEvent (QContextMenuEvent *e) override
 
bool isProcessVarItem (const QModelIndex &idx) const
 
bool isConditionItem (const QModelIndex &idx) const
 

Constructor & Destructor Documentation

◆ ProcessView()

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

Constructor.

Definition at line 22 of file ProcessView.cpp.

22: QTreeView(parent) {}

Member Function Documentation

◆ clearConditionView

void ProcessView::clearConditionView ( )
signal

◆ conditionRemoved

void ProcessView::conditionRemoved ( QString const & ,
QString const &  )
signal

Referenced by removeCondition().

◆ conditionSelected

void ProcessView::conditionSelected ( DataHolderLib::FemCondition * cond)
signal

Referenced by selectionChanged().

◆ contextMenuEvent()

void ProcessView::contextMenuEvent ( QContextMenuEvent * e)
overrideprivate

Actions to be taken after a right mouse click is performed in the station view.

Definition at line 70 of file ProcessView.cpp.

71{
72 Q_UNUSED(event);
73
74 const QModelIndex idx(this->selectionModel()->currentIndex());
75 QMenu menu;
76
77 if (isProcessVarItem(idx))
78 {
79 // QAction* saveCondAction = menu.addAction("Save FEM Conditions...");
80 QAction* removeProcessVarAction =
81 menu.addAction("Remove process variable");
82 // connect(saveCondAction, SIGNAL(triggered()), this,
83 // SLOT(saveConditions()));
84 connect(removeProcessVarAction, SIGNAL(triggered()), this,
85 SLOT(removeProcessVar()));
86 }
87 else if (isConditionItem(idx))
88 {
89 QAction* removeCondAction = menu.addAction("Remove condition");
90 connect(removeCondAction, SIGNAL(triggered()), this,
91 SLOT(removeCondition()));
92 // QAction* editCondAction = menu.addAction("Edit condition");
93 // connect(editCondAction, SIGNAL(triggered()), this,
94 // SLOT(editCondition())); else editCondAction->setEnabled(false);
95 }
96
97 menu.exec(event->globalPos());
98}
bool isProcessVarItem(const QModelIndex &idx) const
bool isConditionItem(const QModelIndex &idx) const
void removeProcessVar()
void removeCondition()

References isConditionItem(), isProcessVarItem(), removeCondition(), and removeProcessVar().

◆ isConditionItem()

bool ProcessView::isConditionItem ( const QModelIndex & idx) const
private

Definition at line 157 of file ProcessView.cpp.

158{
159 return (dynamic_cast<CondItem*>(
160 static_cast<ProcessModel*>(this->model())->getItem(idx)) !=
161 nullptr);
162}
A TreeItem containing a boundary condition or source term.
Definition CondItem.h:26
A model implementing a tree structure for process-relevant information such as process types,...

Referenced by contextMenuEvent().

◆ isProcessVarItem()

bool ProcessView::isProcessVarItem ( const QModelIndex & idx) const
private

Definition at line 150 of file ProcessView.cpp.

151{
152 return (dynamic_cast<ProcessVarItem*>(
153 static_cast<ProcessModel*>(this->model())->getItem(idx)) !=
154 nullptr);
155}
A TreeItem representing process variable information.

Referenced by contextMenuEvent().

◆ itemSelectionChanged

void ProcessView::itemSelectionChanged ( QItemSelection const & selected,
QItemSelection const & deselected )
signal

Referenced by selectionChanged().

◆ on_Clicked

void ProcessView::on_Clicked ( QModelIndex idx)
privateslot

Definition at line 32 of file ProcessView.cpp.

33{
34 qDebug("%d, %d", idx.parent().row(), idx.row());
35}

◆ processVarRemoved

void ProcessView::processVarRemoved ( QString const & )
signal

Referenced by removeProcessVar().

◆ processVarSelected

void ProcessView::processVarSelected ( DataHolderLib::FemCondition * cond)
signal

Referenced by selectionChanged().

◆ removeCondition

void ProcessView::removeCondition ( )
privateslot

Definition at line 100 of file ProcessView.cpp.

101{
102 CondItem* item = dynamic_cast<CondItem*>(
103 static_cast<ProcessModel*>(this->model())
104 ->getItem(this->selectionModel()->currentIndex()));
105 if (item)
106 {
107 emit clearConditionView();
108 emit conditionRemoved(
109 QString::fromStdString(item->getCondition()->getProcessVarName()),
110 item->getName());
111 }
112}
DataHolderLib::FemCondition * getCondition() const
Returns the FEM Condition associated with the item.
Definition CondItem.h:36
QString const getName() const
Definition CondItem.h:38
std::string const getProcessVarName() const
Returns the name of the associated process variable.
void conditionRemoved(QString const &, QString const &)
void clearConditionView()

References clearConditionView(), conditionRemoved(), CondItem::getCondition(), CondItem::getName(), and DataHolderLib::FemCondition::getProcessVarName().

Referenced by contextMenuEvent().

◆ removeProcessVar

void ProcessView::removeProcessVar ( )
privateslot

Definition at line 114 of file ProcessView.cpp.

115{
116 ProcessVarItem* item = dynamic_cast<ProcessVarItem*>(
117 static_cast<ProcessModel*>(this->model())
118 ->getItem(this->selectionModel()->currentIndex()));
119 if (item)
120 {
121 emit clearConditionView();
122 emit processVarRemoved(item->getName());
123 }
124}
QString getName() const
void processVarRemoved(QString const &)

References clearConditionView(), ProcessVarItem::getName(), and processVarRemoved().

Referenced by contextMenuEvent().

◆ selectionChanged

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

Instructions if the selection of items in the view has changed.

Definition at line 37 of file ProcessView.cpp.

39{
40 if (!selected.isEmpty())
41 {
42 emit clearConditionView();
43 const QModelIndex idx = *(selected.indexes().begin());
44
45 if (idx.parent().isValid()) // not root node
46 {
47 CondItem const* const item = dynamic_cast<CondItem*>(
48 static_cast<ProcessModel*>(this->model())->getItem(idx));
49 if (item != nullptr)
50 {
51 emit conditionSelected(item->getCondition());
52 }
53 }
54 else
55 {
56 CondItem const* const item = dynamic_cast<CondItem*>(
57 static_cast<ProcessModel*>(this->model())
58 ->getItem(idx)
59 ->child(0));
60 if (item != nullptr)
61 {
62 emit processVarSelected(item->getCondition());
63 }
64 }
65 }
66 emit itemSelectionChanged(selected, deselected);
67 QTreeView::selectionChanged(selected, deselected);
68}
void conditionSelected(DataHolderLib::FemCondition *cond)
void itemSelectionChanged(QItemSelection const &selected, QItemSelection const &deselected)
void processVarSelected(DataHolderLib::FemCondition *cond)

References clearConditionView(), conditionSelected(), CondItem::getCondition(), itemSelectionChanged(), and processVarSelected().

◆ updateView()

void ProcessView::updateView ( )

Update the view to visualise changes made to the underlying data.

Definition at line 24 of file ProcessView.cpp.

25{
26 setAlternatingRowColors(true);
27 resizeColumnToContents(0);
28 setColumnWidth(1, 50);
29 setColumnWidth(2, 50);
30}

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