##// END OF EJS Templates
Inits threshold mode buttons (auto or manual)...
Alexandre Leroux -
r1044:d3d71155af5e
parent child
Show More
@@ -1,24 +1,30
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 {
7 class ColorScaleEditor;
8 class ColorScaleEditor;
8 } // Ui
9 } // Ui
9
10
10 /**
11 /**
11 * @brief The ColorScaleEditor class represents the widget to set properties of color scale's graphs
12 * @brief The ColorScaleEditor class represents the widget to set properties of color scale's graphs
12 */
13 */
13 class ColorScaleEditor : public QDialog {
14 class ColorScaleEditor : public QDialog {
14 Q_OBJECT
15 Q_OBJECT
15
16
16 public:
17 public:
17 explicit ColorScaleEditor(QWidget *parent = 0);
18 explicit ColorScaleEditor(QWidget *parent = 0);
18 virtual ~ColorScaleEditor() noexcept;
19 virtual ~ColorScaleEditor() noexcept;
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
@@ -1,13 +1,34
1 #include "Visualization/ColorScaleEditor.h"
1 #include "Visualization/ColorScaleEditor.h"
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