cut 3.4.3
Loading...
Searching...
No Matches
QeColorMap.hpp
1#ifndef QECOLORMAP_HPP
2#define QECOLORMAP_HPP
3
4#include "elt/cut/widgets/widgets/QeLinearGradient.hpp"
5#include <QObject>
6#include <QWidget>
7
8class Ui_QeColorMap;
9
15class QeColorMap: public QWidget{
16 Q_OBJECT
17
21 Q_PROPERTY(double startValue MEMBER m_startValue READ StartValue WRITE SetStartValue NOTIFY StartValueChanged)
22
23
26 Q_PROPERTY(double stopValue MEMBER m_stopValue READ StopValue WRITE SetStopValue NOTIFY StoptValueChanged)
27
32 Q_PROPERTY(QColor startColor MEMBER m_startColor READ GetStartColor WRITE SetStartColor NOTIFY StartColorChanged RESET ResetStartColor)
33
38 Q_PROPERTY(QColor stopColor MEMBER m_stopColor READ GetStopColor WRITE SetStopColor NOTIFY StopColorChanged RESET ResetStopColor)
39
40public:
45 QeColorMap(QWidget* parent=nullptr);
46
51 double StartValue() const;
52
57 double StopValue() const;
58
63 QColor GetStartColor() const;
64
65
69 void ResetStartColor();
70
75 QColor GetStopColor() const;
76
80 void ResetStopColor();
81
82 void AddColorStop(double value, QColor color);
83
84public slots:
85
90 void SetStartColor(const QColor &newStartColor);
91
96 void SetStopColor(const QColor &newStopColor);
97
102 void SetStartValue(const double &newStartValue);
103 void SetStartValue(const QString &newStartValue){
104 bool ok(false);
105 double d = newStartValue.toDouble(&ok);
106 if (ok) {
107 SetStartValue(d);
108 }
109 };
110
115 void SetStopValue(const double &newStopValue);
116 void SetStopValue(const QString &newStopValue){
117 bool ok(false);
118 double d = newStopValue.toDouble(&ok);
119 if (ok) {
120 SetStopValue(d);
121 }
122 };
123
127 void ClearStops();
128
129
130signals:
131
136
141
146
151
152
153protected:
154
155private:
156 void RecreateColorMap();
157 QVector<double> CalculateTicks(double start, double end);
158 Ui_QeColorMap* ui;
159
160 double m_startValueDouble;
161 double m_stopValueDouble;
162 QColor m_startColor;
163 QColor m_stopColor;
164 QMap<double, QColor> m_colorStops;
165};
166
167#endif // QECOLORMAP_HPP
void SetStartValue(const double &newStartValue)
Setter for the double to be shown at the start value position in the gradient.
Definition QeColorMap.cpp:47
void StopColorChanged()
StopColorChanged Signal emitted when StopColor property changes.
double StopValue() const
StopValue returns the Stop Value string.
Definition QeColorMap.cpp:42
void ResetStartColor()
ResetStartColor resets the value to its default: white (255, 255, 255)
Definition QeColorMap.cpp:117
void ClearStops()
Removes all stops: color maps points.
Definition QeColorMap.cpp:59
void StartColorChanged()
StartColorChanged Signal emitted when StartColor property changes.
void StartValueChanged()
StartValueChanged Signal emitted when the string shown at the start of gradient changes.
void SetStartColor(const QColor &newStartColor)
Replaces or sets the color at position 0.0.
Definition QeColorMap.cpp:108
QeColorMap(QWidget *parent=nullptr)
QeColorMap default constructor.
Definition QeColorMap.cpp:18
QColor GetStartColor() const
GetStartColor returns the Start color of the gradient: position 0.0.
Definition QeColorMap.cpp:103
void SetStopColor(const QColor &newStopColor)
Replaces or sets the color at position 1.0.
Definition QeColorMap.cpp:127
QColor stopColor
Stop color (1.0) of the gradient.
Definition QeColorMap.hpp:38
double startValue
Sets the value to show in the label at the Start of the gradient.
Definition QeColorMap.hpp:21
QColor GetStopColor() const
GetStopColor returns the Stop color of the gradient: position 1.0.
Definition QeColorMap.cpp:122
QColor startColor
Start color (0.0) of the gradient.
Definition QeColorMap.hpp:32
void ResetStopColor()
ResetStartColor resets the value to its default: black (0, 0, 0)
Definition QeColorMap.cpp:136
double stopValue
Sets the value to show in the label at the Stop of the gradient.
Definition QeColorMap.hpp:26
double StartValue() const
StartValue returns the Start Value string.
Definition QeColorMap.cpp:37
void StoptValueChanged()
StartValueChanged Signal emitted when the string shown at the stop of gradient changes.
void SetStopValue(const double &newStopValue)
Setter for the double to be shown at the stop value position in the gradient.
Definition QeColorMap.cpp:53