OGS
AddLayerToMeshDialog Class Reference

Detailed Description

A dialog window for adding a layer to the top or bottom of a mesh.

Definition at line 25 of file AddLayerToMeshDialog.h.

#include <AddLayerToMeshDialog.h>

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

Public Member Functions

 AddLayerToMeshDialog (QDialog *parent=nullptr)
 
bool isTopLayer () const
 Returns if the top layer button is selected (if false, bottom is selected). More...
 
double getThickness () const
 Returns the thickness of the new layer. More...
 
std::string getName () const
 Returns the name of the new mesh. More...
 

Private Slots

void accept () override
 Instructions if the OK-Button has been pressed. More...
 
void reject () override
 Instructions if the Cancel-Button has been pressed. More...
 

Constructor & Destructor Documentation

◆ AddLayerToMeshDialog()

AddLayerToMeshDialog::AddLayerToMeshDialog ( QDialog *  parent = nullptr)
explicit

Definition at line 20 of file AddLayerToMeshDialog.cpp.

20  : QDialog(parent)
21 {
22  setupUi(this);
23 
24  auto* thickness_validator = new StrictDoubleValidator(0, 1000000, 7, this);
25  this->thicknessEdit->setValidator(thickness_validator);
26 }
A validator for an input field which only accepts decimals. Source code adapted from StackOverflow

Member Function Documentation

◆ accept

void AddLayerToMeshDialog::accept ( )
overrideprivateslot

Instructions if the OK-Button has been pressed.

Definition at line 28 of file AddLayerToMeshDialog.cpp.

29 {
30  if (this->nameEdit->text().isEmpty())
31  {
32  OGSError::box("Please enter a name for the new Mesh.");
33  }
34  else if (this->thicknessEdit->text().isEmpty() ||
35  this->thicknessEdit->text().toDouble() <= 0)
36  {
37  OGSError::box("Thickness needs to be larger 0");
38  }
39  else
40  {
41  this->done(QDialog::Accepted);
42  }
43 }
static void box(const QString &e)
Definition: OGSError.cpp:23

References OGSError::box().

◆ getName()

std::string AddLayerToMeshDialog::getName ( ) const
inline

Returns the name of the new mesh.

Definition at line 39 of file AddLayerToMeshDialog.h.

39 { return this->nameEdit->text().toStdString(); };

Referenced by MeshView::openAddLayerDialog().

◆ getThickness()

double AddLayerToMeshDialog::getThickness ( ) const
inline

Returns the thickness of the new layer.

Definition at line 36 of file AddLayerToMeshDialog.h.

36 { return this->thicknessEdit->text().toDouble(); };

Referenced by MeshView::openAddLayerDialog().

◆ isTopLayer()

bool AddLayerToMeshDialog::isTopLayer ( ) const
inline

Returns if the top layer button is selected (if false, bottom is selected).

Definition at line 33 of file AddLayerToMeshDialog.h.

33 { return this->topButton->isChecked(); };

Referenced by MeshView::openAddLayerDialog().

◆ reject

void AddLayerToMeshDialog::reject ( )
overrideprivateslot

Instructions if the Cancel-Button has been pressed.

Definition at line 45 of file AddLayerToMeshDialog.cpp.

46 {
47  this->done(QDialog::Rejected);
48 }

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