##// END OF EJS Templates
Implements preview update...
Alexandre Leroux -
r1048:24ae1d9817ff
parent child
Show More
@@ -32,6 +32,9 private slots:
32 32 void onMinChanged();
33 33 /// Slot called when the threshold mode (auto or manual) changes
34 34 void onThresholdChanged(bool checked);
35
36 /// Slot called when a property of the color scale changed
37 void updatePreview();
35 38 };
36 39
37 40 #endif // SCIQLOP_COLORSCALEEDITOR_H
@@ -58,6 +58,7 ColorScaleEditor::ColorScaleEditor(QWidget *parent)
58 58 ui->plot->plotLayout()->addElement(0, 0, m_PreviewScale);
59 59
60 60 // Inits connections
61 connect(ui->gradientComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePreview()));
61 62 connect(ui->thresholdAutoButton, SIGNAL(toggled(bool)), this, SLOT(onThresholdChanged(bool)));
62 63 connect(ui->thresholdManualButton, SIGNAL(toggled(bool)), this, SLOT(onThresholdChanged(bool)));
63 64 connect(ui->minSpinBox, SIGNAL(editingFinished()), this, SLOT(onMinChanged()));
@@ -65,6 +66,7 ColorScaleEditor::ColorScaleEditor(QWidget *parent)
65 66
66 67 // First update
67 68 onThresholdChanged(true);
69 updatePreview();
68 70 }
69 71
70 72 ColorScaleEditor::~ColorScaleEditor() noexcept
@@ -80,6 +82,7 void ColorScaleEditor::onMaxChanged()
80 82 ui->minSpinBox->setValue(maxValue);
81 83 }
82 84
85 updatePreview();
83 86 }
84 87
85 88 void ColorScaleEditor::onMinChanged()
@@ -90,6 +93,7 void ColorScaleEditor::onMinChanged()
90 93 ui->maxSpinBox->setValue(minValue);
91 94 }
92 95
96 updatePreview();
93 97 }
94 98
95 99 void ColorScaleEditor::onThresholdChanged(bool checked)
@@ -102,3 +106,11 void ColorScaleEditor::onThresholdChanged(bool checked)
102 106 }
103 107 }
104 108
109 void ColorScaleEditor::updatePreview()
110 {
111 m_PreviewScale->setDataRange(QCPRange{ui->minSpinBox->value(), ui->maxSpinBox->value()});
112 m_PreviewScale->setGradient(
113 ui->gradientComboBox->currentData().value<QCPColorGradient::GradientPreset>());
114
115 ui->plot->replot();
116 }
General Comments 0
You need to be logged in to leave comments. Login now