@@ -1,24 +1,30 | |||
|
1 | 1 | #ifndef SCIQLOP_COLORSCALEEDITOR_H |
|
2 | 2 | #define SCIQLOP_COLORSCALEEDITOR_H |
|
3 | 3 | |
|
4 | #include <QButtonGroup> | |
|
4 | 5 | #include <QDialog> |
|
5 | 6 | |
|
6 | 7 | namespace Ui { |
|
7 | 8 | class ColorScaleEditor; |
|
8 | 9 | } // Ui |
|
9 | 10 | |
|
10 | 11 | /** |
|
11 | 12 | * @brief The ColorScaleEditor class represents the widget to set properties of color scale's graphs |
|
12 | 13 | */ |
|
13 | 14 | class ColorScaleEditor : public QDialog { |
|
14 | 15 | Q_OBJECT |
|
15 | 16 | |
|
16 | 17 | public: |
|
17 | 18 | explicit ColorScaleEditor(QWidget *parent = 0); |
|
18 | 19 | virtual ~ColorScaleEditor() noexcept; |
|
19 | 20 | |
|
20 | 21 | private: |
|
21 | 22 | Ui::ColorScaleEditor *ui; |
|
23 | QButtonGroup *m_ThresholdGroup; | |
|
24 | ||
|
25 | private slots: | |
|
26 | /// Slot called when the threshold mode (auto or manual) changes | |
|
27 | void onThresholdChanged(bool checked); | |
|
22 | 28 | }; |
|
23 | 29 | |
|
24 | 30 | #endif // SCIQLOP_COLORSCALEEDITOR_H |
@@ -1,13 +1,34 | |||
|
1 | 1 | #include "Visualization/ColorScaleEditor.h" |
|
2 | 2 | |
|
3 | 3 | #include "ui_ColorScaleEditor.h" |
|
4 | 4 | |
|
5 |
ColorScaleEditor::ColorScaleEditor(QWidget *parent) |
|
|
5 | ColorScaleEditor::ColorScaleEditor(QWidget *parent) | |
|
6 | : QDialog{parent}, ui{new Ui::ColorScaleEditor}, m_ThresholdGroup{new QButtonGroup{this}} | |
|
6 | 7 | { |
|
7 | 8 | ui->setupUi(this); |
|
9 | // Creates threshold group | |
|
10 | m_ThresholdGroup->addButton(ui->thresholdAutoButton); | |
|
11 | m_ThresholdGroup->addButton(ui->thresholdManualButton); | |
|
12 | ||
|
13 | // Inits connections | |
|
14 | connect(ui->thresholdAutoButton, SIGNAL(toggled(bool)), this, SLOT(onThresholdChanged(bool))); | |
|
15 | connect(ui->thresholdManualButton, SIGNAL(toggled(bool)), this, SLOT(onThresholdChanged(bool))); | |
|
16 | ||
|
17 | // First update | |
|
18 | onThresholdChanged(true); | |
|
8 | 19 | } |
|
9 | 20 | |
|
10 | 21 | ColorScaleEditor::~ColorScaleEditor() noexcept |
|
11 | 22 | { |
|
12 | 23 | delete ui; |
|
13 | 24 | } |
|
25 | void ColorScaleEditor::onThresholdChanged(bool checked) | |
|
26 | { | |
|
27 | if (checked) { | |
|
28 | auto isAutomatic = ui->thresholdAutoButton == m_ThresholdGroup->checkedButton(); | |
|
29 | ||
|
30 | ui->minSpinBox->setEnabled(!isAutomatic); | |
|
31 | ui->maxSpinBox->setEnabled(!isAutomatic); | |
|
32 | } | |
|
33 | } | |
|
34 |
General Comments 0
You need to be logged in to leave comments.
Login now