-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathColourLegend.h
65 lines (54 loc) · 1.53 KB
/
ColourLegend.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @file ColourLegend.h
* @author Donal Evans
* @date 19 Aug 2016
* @brief This class provides a widget painted with a colour gradient
* for use as a legend.
*
* Detailed description goes here
*/
#ifndef COLOURLEGEND_H
#define COLOURLEGEND_H
#include <QWidget>
#include <QColor>
#include <QVector>
#include <QVector3D>
class ColourLegend : public QWidget
{
Q_OBJECT
public:
/**
* @brief Sets the colour map for this object to the one in map.
* @param map A QVector of colours, as QVector3D RBG float values, from 0-1.
*/
void SetColourMap(QVector<QVector3D> map);
/**
* @brief Sets the flag for whether or not the colour gradient on this
* object is horizontal.
* @param horizontal True if the colour gradient on the object is
* horizontal, false if vertical.
*/
void SetIsHorizontal(bool horizontal);
/**
* @brief Constructor
* @param parent The parent QWidget of this widget.
*/
ColourLegend(QWidget* parent);
protected:
/**
* @brief Function for painting the colour gradient to the widget.
* @param event The QPaintEvent that triggered painting.
*/
void paintEvent(QPaintEvent *event);
private:
/**
* @brief The colour map to be used to create the colour gradient, as a
* QVector of QVector3D RBG float values, from 0-1.
*/
QVector<QVector3D> m_ColourMap;
/**
* @brief Flag for whether or not the colour gradient will be horizontal.
*/
bool m_IsHorizontal = true;
};
#endif // COLOURLEGEND_H