@@ -22,6 +22,8 public: | |||||
22 | virtual ~ColorScaleEditor() noexcept; |
|
22 | virtual ~ColorScaleEditor() noexcept; | |
23 |
|
23 | |||
24 | private: |
|
24 | private: | |
|
25 | /// Fills the editor fields from color scale data | |||
|
26 | void loadScale(); | |||
25 | Ui::ColorScaleEditor *ui; |
|
27 | Ui::ColorScaleEditor *ui; | |
26 | QButtonGroup *m_ThresholdGroup; |
|
28 | QButtonGroup *m_ThresholdGroup; | |
27 | /// Scale in editing |
|
29 | /// Scale in editing |
@@ -67,9 +67,8 ColorScaleEditor::ColorScaleEditor(SqpColorScale &scale, QWidget *parent) | |||||
67 | connect(ui->minSpinBox, SIGNAL(editingFinished()), this, SLOT(onMinChanged())); |
|
67 | connect(ui->minSpinBox, SIGNAL(editingFinished()), this, SLOT(onMinChanged())); | |
68 | connect(ui->maxSpinBox, SIGNAL(editingFinished()), this, SLOT(onMaxChanged())); |
|
68 | connect(ui->maxSpinBox, SIGNAL(editingFinished()), this, SLOT(onMaxChanged())); | |
69 |
|
69 | |||
70 | // First update |
|
70 | // Loads color scale | |
71 | onThresholdChanged(true); |
|
71 | loadScale(); | |
72 | updatePreview(); |
|
|||
73 | } |
|
72 | } | |
74 |
|
73 | |||
75 | ColorScaleEditor::~ColorScaleEditor() noexcept |
|
74 | ColorScaleEditor::~ColorScaleEditor() noexcept | |
@@ -77,6 +76,25 ColorScaleEditor::~ColorScaleEditor() noexcept | |||||
77 | delete ui; |
|
76 | delete ui; | |
78 | } |
|
77 | } | |
79 |
|
78 | |||
|
79 | void ColorScaleEditor::loadScale() | |||
|
80 | { | |||
|
81 | // Gradient | |||
|
82 | auto gradientPresetIndex = ui->gradientComboBox->findData(m_Scale.m_GradientPreset); | |||
|
83 | ui->gradientComboBox->setCurrentIndex(gradientPresetIndex); | |||
|
84 | ||||
|
85 | // Threshold mode | |||
|
86 | (m_Scale.m_AutomaticThreshold ? ui->thresholdAutoButton : ui->thresholdManualButton) | |||
|
87 | ->setChecked(true); | |||
|
88 | ||||
|
89 | // Min/max | |||
|
90 | auto qcpColorScale = m_Scale.m_Scale; | |||
|
91 | auto range = qcpColorScale->dataRange(); | |||
|
92 | ui->minSpinBox->setValue(range.lower); | |||
|
93 | ui->maxSpinBox->setValue(range.upper); | |||
|
94 | ||||
|
95 | updatePreview(); | |||
|
96 | } | |||
|
97 | ||||
80 | void ColorScaleEditor::onMaxChanged() |
|
98 | void ColorScaleEditor::onMaxChanged() | |
81 | { |
|
99 | { | |
82 | // Ensures that max >= min |
|
100 | // Ensures that max >= min |
General Comments 0
You need to be logged in to leave comments.
Login now