OGS
SelectMeshDialog.cpp
Go to the documentation of this file.
1
15#include "SelectMeshDialog.h"
16
17#include <QComboBox>
18#include <QDialogButtonBox>
19#include <QLabel>
20#include <QVBoxLayout>
21
22#include "GeoLib/GeoObject.h"
23
25 const std::list<std::string>& msh_names,
26 QDialog* parent)
27 : QDialog(parent), _geo_object(geo_object)
28{
29 setupDialog(msh_names);
30 show();
31}
32
34{
35 delete _buttonBox;
36 delete _layout;
37 delete _msh_names;
38 delete _txt_label;
39}
40
41void SelectMeshDialog::setupDialog(const std::list<std::string>& msh_names)
42{
43 _layout = new QVBoxLayout(this);
44 QString dialog_text("Select Mesh");
45 _txt_label = new QLabel(this);
46 _txt_label->setText(dialog_text);
47
48 _msh_names = new QComboBox();
49 for (const auto& msh_name : msh_names)
50 {
51 _msh_names->addItem(QString::fromStdString(msh_name));
52 }
53
54 setWindowTitle("Select Mesh...");
55 _layout->addWidget(_txt_label);
56 _layout->addWidget(_msh_names);
58 new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
59 connect(_buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
60 connect(_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
61 _layout->addWidget(_buttonBox);
62
63 setLayout(_layout);
64}
65
67{
68 // emit requestNameChange(_parent_name,
69 // GeoLib::convertGeoType(_object_type_name), _id,
70 // _new_name->text().toStdString());
71 this->done(QDialog::Accepted);
72}
73
75{
76 this->done(QDialog::Rejected);
77}
Base class for classes Point, Polyline, Surface.
Definition of the SelectMeshDialog class.
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.