@@ -22,6 +22,8 public: | |||
|
22 | 22 | virtual ~ColorScaleEditor() noexcept; |
|
23 | 23 | |
|
24 | 24 | private: |
|
25 | /// Fills the editor fields from color scale data | |
|
26 | void loadScale(); | |
|
25 | 27 | Ui::ColorScaleEditor *ui; |
|
26 | 28 | QButtonGroup *m_ThresholdGroup; |
|
27 | 29 | /// Scale in editing |
@@ -67,9 +67,8 ColorScaleEditor::ColorScaleEditor(SqpColorScale &scale, QWidget *parent) | |||
|
67 | 67 | connect(ui->minSpinBox, SIGNAL(editingFinished()), this, SLOT(onMinChanged())); |
|
68 | 68 | connect(ui->maxSpinBox, SIGNAL(editingFinished()), this, SLOT(onMaxChanged())); |
|
69 | 69 | |
|
70 | // First update | |
|
71 | onThresholdChanged(true); | |
|
72 | updatePreview(); | |
|
70 | // Loads color scale | |
|
71 | loadScale(); | |
|
73 | 72 | } |
|
74 | 73 | |
|
75 | 74 | ColorScaleEditor::~ColorScaleEditor() noexcept |
@@ -77,6 +76,25 ColorScaleEditor::~ColorScaleEditor() noexcept | |||
|
77 | 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 | 98 | void ColorScaleEditor::onMaxChanged() |
|
81 | 99 | { |
|
82 | 100 | // Ensures that max >= min |
General Comments 0
You need to be logged in to leave comments.
Login now