##// END OF EJS Templates
Inits threshold mode buttons (auto or manual)...
Alexandre Leroux -
r1044:d3d71155af5e
parent child
Show More
@@ -1,6 +1,7
1 #ifndef SCIQLOP_COLORSCALEEDITOR_H
1 #ifndef SCIQLOP_COLORSCALEEDITOR_H
2 #define SCIQLOP_COLORSCALEEDITOR_H
2 #define SCIQLOP_COLORSCALEEDITOR_H
3
3
4 #include <QButtonGroup>
4 #include <QDialog>
5 #include <QDialog>
5
6
6 namespace Ui {
7 namespace Ui {
@@ -19,6 +20,11 public:
19
20
20 private:
21 private:
21 Ui::ColorScaleEditor *ui;
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 #endif // SCIQLOP_COLORSCALEEDITOR_H
30 #endif // SCIQLOP_COLORSCALEEDITOR_H
@@ -2,12 +2,33
2
2
3 #include "ui_ColorScaleEditor.h"
3 #include "ui_ColorScaleEditor.h"
4
4
5 ColorScaleEditor::ColorScaleEditor(QWidget *parent) : QDialog{parent}, ui{new Ui::ColorScaleEditor}
5 ColorScaleEditor::ColorScaleEditor(QWidget *parent)
6 : QDialog{parent}, ui{new Ui::ColorScaleEditor}, m_ThresholdGroup{new QButtonGroup{this}}
6 {
7 {
7 ui->setupUi(this);
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 ColorScaleEditor::~ColorScaleEditor() noexcept
21 ColorScaleEditor::~ColorScaleEditor() noexcept
11 {
22 {
12 delete ui;
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