OGS
AddLayerToMeshDialog.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
6#include "Base/OGSError.h"
8
9AddLayerToMeshDialog::AddLayerToMeshDialog(QDialog* parent) : QDialog(parent)
10{
11 setupUi(this);
12
13 auto* thickness_validator = new StrictDoubleValidator(0, 1000000, 7, this);
14 this->thicknessEdit->setValidator(thickness_validator);
15}
16
18{
19 if (this->nameEdit->text().isEmpty())
20 {
21 OGSError::box("Please enter a name for the new Mesh.");
22 }
23 else if (this->thicknessEdit->text().isEmpty() ||
24 this->thicknessEdit->text().toDouble() <= 0)
25 {
26 OGSError::box("Thickness needs to be larger 0");
27 }
28 else
29 {
30 this->done(QDialog::Accepted);
31 }
32}
33
35{
36 this->done(QDialog::Rejected);
37}
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:13
A validator for an input field which only accepts decimals. Source code adapted from StackOverflow