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 18 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 15 of file ProcessView.cpp.

15: 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 63 of file ProcessView.cpp.

64{
65 Q_UNUSED(event);
66
67 const QModelIndex idx(this->selectionModel()->currentIndex());
68 QMenu menu;
69
70 if (isProcessVarItem(idx))
71 {
72 // QAction* saveCondAction = menu.addAction("Save FEM Conditions...");
73 QAction* removeProcessVarAction =
74 menu.addAction("Remove process variable");
75 // connect(saveCondAction, SIGNAL(triggered()), this,
76 // SLOT(saveConditions()));
77 connect(removeProcessVarAction, SIGNAL(triggered()), this,
78 SLOT(removeProcessVar()));
79 }
80 else if (isConditionItem(idx))
81 {
82 QAction* removeCondAction = menu.addAction("Remove condition");
83 connect(removeCondAction, SIGNAL(triggered()), this,
84 SLOT(removeCondition()));
85 // QAction* editCondAction = menu.addAction("Edit condition");
86 // connect(editCondAction, SIGNAL(triggered()), this,
87 // SLOT(editCondition())); else editCondAction->setEnabled(false);
88 }
89
90 menu.exec(event->globalPos());
91}
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 150 of file ProcessView.cpp.

151{
152 return (dynamic_cast<CondItem*>(
153 static_cast<ProcessModel*>(this->model())->getItem(idx)) !=
154 nullptr);
155}

Referenced by contextMenuEvent().

◆ isProcessVarItem()

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

Definition at line 143 of file ProcessView.cpp.

144{
145 return (dynamic_cast<ProcessVarItem*>(
146 static_cast<ProcessModel*>(this->model())->getItem(idx)) !=
147 nullptr);
148}

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 25 of file ProcessView.cpp.

26{
27 qDebug("%d, %d", idx.parent().row(), idx.row());
28}

◆ 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 93 of file ProcessView.cpp.

94{
95 CondItem* item = dynamic_cast<CondItem*>(
96 static_cast<ProcessModel*>(this->model())
97 ->getItem(this->selectionModel()->currentIndex()));
98 if (item)
99 {
100 emit clearConditionView();
101 emit conditionRemoved(
102 QString::fromStdString(item->getCondition()->getProcessVarName()),
103 item->getName());
104 }
105}
DataHolderLib::FemCondition * getCondition() const
Returns the FEM Condition associated with the item.
Definition CondItem.h:29
QString const getName() const
Definition CondItem.h:31
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(), TreeModel::getItem(), CondItem::getName(), and DataHolderLib::FemCondition::getProcessVarName().

Referenced by contextMenuEvent().

◆ removeProcessVar

void ProcessView::removeProcessVar ( )
privateslot

Definition at line 107 of file ProcessView.cpp.

108{
109 ProcessVarItem* item = dynamic_cast<ProcessVarItem*>(
110 static_cast<ProcessModel*>(this->model())
111 ->getItem(this->selectionModel()->currentIndex()));
112 if (item)
113 {
114 emit clearConditionView();
115 emit processVarRemoved(item->getName());
116 }
117}
QString getName() const
void processVarRemoved(QString const &)

References clearConditionView(), TreeModel::getItem(), 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 30 of file ProcessView.cpp.

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

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

◆ updateView()

void ProcessView::updateView ( )

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

Definition at line 17 of file ProcessView.cpp.

18{
19 setAlternatingRowColors(true);
20 resizeColumnToContents(0);
21 setColumnWidth(1, 50);
22 setColumnWidth(2, 50);
23}

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