@@ -8,6 +8,8 namespace Ui { | |||
|
8 | 8 | class ColorScaleEditor; |
|
9 | 9 | } // Ui |
|
10 | 10 | |
|
11 | class QCPColorScale; | |
|
12 | ||
|
11 | 13 | /** |
|
12 | 14 | * @brief The ColorScaleEditor class represents the widget to set properties of color scale's graphs |
|
13 | 15 | */ |
@@ -21,6 +23,7 public: | |||
|
21 | 23 | private: |
|
22 | 24 | Ui::ColorScaleEditor *ui; |
|
23 | 25 | QButtonGroup *m_ThresholdGroup; |
|
26 | QCPColorScale *m_PreviewScale; ///< Scale shown as preview | |
|
24 | 27 | |
|
25 | 28 | private slots: |
|
26 | 29 | /// Slot called when max threshold value changes |
@@ -1,4 +1,5 | |||
|
1 | 1 | #include "Visualization/ColorScaleEditor.h" |
|
2 | #include "Visualization/qcustomplot.h" | |
|
2 | 3 | |
|
3 | 4 | #include "ui_ColorScaleEditor.h" |
|
4 | 5 | |
@@ -42,6 +43,20 ColorScaleEditor::ColorScaleEditor(QWidget *parent) | |||
|
42 | 43 | setSpinBoxProperties(*ui->minSpinBox); |
|
43 | 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 | 60 | // Inits connections |
|
46 | 61 | connect(ui->thresholdAutoButton, SIGNAL(toggled(bool)), this, SLOT(onThresholdChanged(bool))); |
|
47 | 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