OGS
MeshQualitySelectionDialog.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 <QFileDialog>
7#include <QFileInfo>
8#include <QSettings>
9
10#include "Base/OGSError.h"
11
14 : QDialog(parent), _histogram_path("")
15{
16 setupUi(this);
17 this->choiceEdges->toggle();
18}
19
21
23 bool is_checked) const
24{
25 histogramPathEdit->setEnabled(is_checked);
26 histogramPathButton->setEnabled(is_checked);
27}
28
30{
31 QSettings settings;
32 QFileInfo fi(settings.value("lastOpenedFileDirectory").toString());
33 QString file_name =
34 QFileDialog::getSaveFileName(this, "Save histogram as", fi.baseName(),
35 "Text files (*.txt);;All files (* *.*)");
36 this->histogramPathEdit->setText(file_name);
37}
38
41{
42 if (this->choiceEdges->isChecked())
43 {
45 }
46 else if (this->choiceArea->isChecked())
47 {
49 }
50 else if (this->choiceVolume->isChecked())
51 {
53 }
54 else if (this->choiceAngles->isChecked())
55 {
57 }
58 else if (this->choiceRadius->isChecked())
59 {
61 }
62 else
63 {
65 }
66
67 if (this->histogramCheckBox->isChecked())
68 {
69 _histogram_path = this->histogramPathEdit->text().toStdString();
70 if (_histogram_path.empty())
71 {
72 OGSError::box("No path for histogram file specified.");
73 return;
74 }
75 }
76
77 this->done(QDialog::Accepted);
78}
79
82{
83 this->done(QDialog::Rejected);
84}
~MeshQualitySelectionDialog() override
void accept() override
Instructions if the OK-Button has been pressed.
MeshQualitySelectionDialog(QDialog *parent=nullptr)
Constructor.
void reject() override
Instructions if the Cancel-Button has been pressed.
void on_histogramCheckBox_toggled(bool is_checked) const
static void box(const QString &e)
Definition OGSError.cpp:13