OGS
AddLayerToMeshDialog.cpp
Go to the documentation of this file.
1
16
17#include "Base/OGSError.h"
19
20AddLayerToMeshDialog::AddLayerToMeshDialog(QDialog* parent) : QDialog(parent)
21{
22 setupUi(this);
23
24 auto* thickness_validator = new StrictDoubleValidator(0, 1000000, 7, this);
25 this->thicknessEdit->setValidator(thickness_validator);
26}
27
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}
44
46{
47 this->done(QDialog::Rejected);
48}
Definition of the AddLayerToMeshDialog class.
Definition of the OGSError class.
Implementation of the StrictDoubleValidator class.
void accept() override
Instructions if the OK-Button has been pressed.
AddLayerToMeshDialog(QDialog *parent=nullptr)
void reject() override
Instructions if the Cancel-Button has been pressed.
static void box(const QString &e)
Definition OGSError.cpp:23
A validator for an input field which only accepts decimals. Source code adapted from StackOverflow