##// END OF EJS Templates
Inits color scale preview
Alexandre Leroux -
r1047:a1745cf2759f
parent child
Show More
@@ -8,6 +8,8 namespace Ui {
8 class ColorScaleEditor;
8 class ColorScaleEditor;
9 } // Ui
9 } // Ui
10
10
11 class QCPColorScale;
12
11 /**
13 /**
12 * @brief The ColorScaleEditor class represents the widget to set properties of color scale's graphs
14 * @brief The ColorScaleEditor class represents the widget to set properties of color scale's graphs
13 */
15 */
@@ -21,6 +23,7 public:
21 private:
23 private:
22 Ui::ColorScaleEditor *ui;
24 Ui::ColorScaleEditor *ui;
23 QButtonGroup *m_ThresholdGroup;
25 QButtonGroup *m_ThresholdGroup;
26 QCPColorScale *m_PreviewScale; ///< Scale shown as preview
24
27
25 private slots:
28 private slots:
26 /// Slot called when max threshold value changes
29 /// Slot called when max threshold value changes
@@ -1,4 +1,5
1 #include "Visualization/ColorScaleEditor.h"
1 #include "Visualization/ColorScaleEditor.h"
2 #include "Visualization/qcustomplot.h"
2
3
3 #include "ui_ColorScaleEditor.h"
4 #include "ui_ColorScaleEditor.h"
4
5
@@ -42,6 +43,20 ColorScaleEditor::ColorScaleEditor(QWidget *parent)
42 setSpinBoxProperties(*ui->minSpinBox);
43 setSpinBoxProperties(*ui->minSpinBox);
43 setSpinBoxProperties(*ui->maxSpinBox);
44 setSpinBoxProperties(*ui->maxSpinBox);
44
45
46 // Creates color scale preview
47 m_PreviewScale = new QCPColorScale{ui->plot};
48 m_PreviewScale->setType(QCPAxis::atTop);
49 m_PreviewScale->setMinimumMargins(QMargins{5, 5, 5, 5});
50 m_PreviewScale->axis()->setScaleType(QCPAxis::stLogarithmic);
51 m_PreviewScale->axis()->setNumberPrecision(0);
52 m_PreviewScale->axis()->setNumberFormat("eb");
53 m_PreviewScale->axis()->setTicker(QSharedPointer<QCPAxisTickerLog>::create());
54 m_PreviewScale->setGradient(QCPColorGradient{QCPColorGradient::gpJet});
55
56 ui->plot->plotLayout()->clear();
57 ui->plot->plotLayout()->insertRow(0);
58 ui->plot->plotLayout()->addElement(0, 0, m_PreviewScale);
59
45 // Inits connections
60 // Inits connections
46 connect(ui->thresholdAutoButton, SIGNAL(toggled(bool)), this, SLOT(onThresholdChanged(bool)));
61 connect(ui->thresholdAutoButton, SIGNAL(toggled(bool)), this, SLOT(onThresholdChanged(bool)));
47 connect(ui->thresholdManualButton, SIGNAL(toggled(bool)), this, SLOT(onThresholdChanged(bool)));
62 connect(ui->thresholdManualButton, SIGNAL(toggled(bool)), this, SLOT(onThresholdChanged(bool)));
General Comments 0
You need to be logged in to leave comments. Login now