cut 3.4.6
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 ~QeColorMap() override;
47
52 double StartValue() const;
53
58 double StopValue() const;
59
64 QColor GetStartColor() const;
65
66
70 void ResetStartColor();
71
76 QColor GetStopColor() const;
77
81 void ResetStopColor();
82
83 void AddColorStop(double value, QColor color);
84
85public slots:
86
91 void SetStartColor(const QColor &newStartColor);
92
97 void SetStopColor(const QColor &newStopColor);
98
103 void SetStartValue(const double &newStartValue);
104 void SetStartValue(const QString &newStartValue){
105 bool ok(false);
106 double d = newStartValue.toDouble(&ok);
107 if (ok) {
108 SetStartValue(d);
109 }
110 };
111
116 void SetStopValue(const double &newStopValue);
117 void SetStopValue(const QString &newStopValue){
118 bool ok(false);
119 double d = newStopValue.toDouble(&ok);
120 if (ok) {
121 SetStopValue(d);
122 }
123 };
124
128 void ClearStops();
129
130
131signals:
132
137
142
147
152
153
154protected:
155
156private:
157 void RecreateColorMap();
158 QVector<double> CalculateTicks(double start, double end);
159 Ui_QeColorMap* ui;
160
161 double m_startValueDouble;
162 double m_stopValueDouble;
163 QColor m_startColor;
164 QColor m_stopColor;
165 QMap<double, QColor> m_colorStops;
166};
167
168#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:52
void StopColorChanged()
StopColorChanged Signal emitted when StopColor property changes.
double StopValue() const
StopValue returns the Stop Value string.
Definition QeColorMap.cpp:47
void ResetStartColor()
ResetStartColor resets the value to its default: white (255, 255, 255)
Definition QeColorMap.cpp:122
void ClearStops()
Removes all stops: color maps points.
Definition QeColorMap.cpp:64
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:113
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:108
void SetStopColor(const QColor &newStopColor)
Replaces or sets the color at position 1.0.
Definition QeColorMap.cpp:132
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:127
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:141
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:42
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:58