OGS
SelectMeshDialog.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
4#include "SelectMeshDialog.h"
5
6#include <QComboBox>
7#include <QDialogButtonBox>
8#include <QLabel>
9#include <QVBoxLayout>
10
11#include "GeoLib/GeoObject.h"
12
14 const std::list<std::string>& msh_names,
15 QDialog* parent)
16 : QDialog(parent), _geo_object(geo_object)
17{
18 setupDialog(msh_names);
19 show();
20}
21
23{
24 delete _buttonBox;
25 delete _layout;
26 delete _msh_names;
27 delete _txt_label;
28}
29
30void SelectMeshDialog::setupDialog(const std::list<std::string>& msh_names)
31{
32 _layout = new QVBoxLayout(this);
33 QString dialog_text("Select Mesh");
34 _txt_label = new QLabel(this);
35 _txt_label->setText(dialog_text);
36
37 _msh_names = new QComboBox();
38 for (const auto& msh_name : msh_names)
39 {
40 _msh_names->addItem(QString::fromStdString(msh_name));
41 }
42
43 setWindowTitle("Select Mesh...");
44 _layout->addWidget(_txt_label);
45 _layout->addWidget(_msh_names);
47 new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
48 connect(_buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
49 connect(_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
50 _layout->addWidget(_buttonBox);
51
52 setLayout(_layout);
53}
54
56{
57 // emit requestNameChange(_parent_name,
58 // GeoLib::convertGeoType(_object_type_name), _id,
59 // _new_name->text().toStdString());
60 this->done(QDialog::Accepted);
61}
62
64{
65 this->done(QDialog::Rejected);
66}
void setupDialog(const std::list< std::string > &msh_names)
The buttons used in this dialog.
SelectMeshDialog(const GeoLib::GeoObject *geo_object, const std::list< std::string > &msh_names, QDialog *parent=nullptr)
Constructor.
QDialogButtonBox * _buttonBox
QComboBox * _msh_names
~SelectMeshDialog() override
QVBoxLayout * _layout
void accept() override
Instructions if the OK-Button has been pressed.
void reject() override
Instructions if the Cancel-Button has been pressed.
const GeoLib::GeoObject * _geo_object