OGS
GeoOnMeshMappingDialog.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"
7#include "MeshLib/Mesh.h"
8
10 std::vector<std::unique_ptr<MeshLib::Mesh>> const& mesh_vec,
11 QDialog* parent)
12 : QDialog(parent), _new_geo_name("")
13{
14 setupUi(this);
15
16 for (const auto& mesh : mesh_vec)
17 {
18 this->meshNameComboBox->addItem(
19 QString::fromStdString(mesh->getName()));
20 }
21}
22
24
26{
27 return this->meshNameComboBox->currentIndex();
28}
29
31{
32 if (idx == 1)
33 {
34 this->normalMappingButton->setChecked(true);
35 }
36
37 bool is_enabled(idx != 1);
38 this->normalMappingButton->setEnabled(is_enabled);
39 this->advancedMappingButton->setEnabled(is_enabled);
40 this->geoNameEdit->setEnabled(is_enabled &&
41 this->advancedMappingButton->isChecked());
42}
43
45{
46 if (this->advancedMappingButton->isChecked())
47 {
48 _new_geo_name = this->geoNameEdit->text().toStdString();
49 if (_new_geo_name.empty())
50 {
51 OGSError::box("Please enter name for new geometry.");
52 return;
53 }
54 }
55 this->done(QDialog::Accepted);
56}
void on_meshNameComboBox_currentIndexChanged(int idx)
GeoOnMeshMappingDialog(std::vector< std::unique_ptr< MeshLib::Mesh > > const &mesh_vec, QDialog *parent=nullptr)
~GeoOnMeshMappingDialog() override
void accept() override
Instructions if the OK-Button has been pressed.
static void box(const QString &e)
Definition OGSError.cpp:13