cut 3.3.0
Loading...
Searching...
No Matches
QeLinearGradient.hpp
1#ifndef QELINEARGRADIENT_HPP
2#define QELINEARGRADIENT_HPP
3
4#include <QObject>
5#include <QWidget>
6#include <QLinearGradient>
7
15class QeLinearGradient: public QWidget{
16 Q_OBJECT
17
22 Q_PROPERTY(bool vertical MEMBER m_vertical READ IsVertical WRITE SetVertical NOTIFY VerticalChanged RESET ResetVertical)
23
24
28 Q_PROPERTY(QColor startColor MEMBER m_startColor READ GetStartColor WRITE SetStartColor NOTIFY StartColorChanged RESET ResetStartColor)
29
34 Q_PROPERTY(QColor stopColor MEMBER m_stopColor READ GetStopColor WRITE SetStopColor NOTIFY StopColorChanged RESET ResetStopColor)
35
36public:
41 QeLinearGradient(QWidget* parent=nullptr);
42
48 bool IsVertical() const;
49
54 void ResetVertical();
55
60 QColor GetStartColor() const;
61
65 void ResetStartColor();
66
71 QColor GetStopColor() const;
72
76 void ResetStopColor();
77
78signals:
79
84
89
94
95public slots:
96
102 void SetVertical(bool newVertical);
103
108 void SetStops(QGradientStops stops);
109
114 void SetStartColor(const QColor &newStartColor);
115
120 void SetStopColor(const QColor &newStopColor);
121
127 void SetColorAt(float pos, QColor colorAt);
128
129protected:
130 void paintEvent(QPaintEvent *event) override;
131private:
132 bool m_vertical;
133 QLinearGradient m_gradient;
134 QColor m_startColor;
135 QColor m_stopColor;
136};
137
138#endif // QELINEARGRADIENT_HPP
QColor GetStartColor() const
GetStartColor returns the Start color of the gradient: position 0.0.
Definition QeLinearGradient.cpp:67
void SetColorAt(float pos, QColor colorAt)
Sets color at specified position in the gradient.
Definition QeLinearGradient.cpp:61
QColor GetStopColor() const
GetStopColor returns the Stop color of the gradient: position 1.0.
Definition QeLinearGradient.cpp:87
void StopColorChanged()
StopColorChanged Signal emitted when StopColor property changes.
void SetStopColor(const QColor &newStopColor)
Replaces or sets the color at position 1.0.
Definition QeLinearGradient.cpp:92
void SetStartColor(const QColor &newStartColor)
Replaces or sets the color at position 0.0.
Definition QeLinearGradient.cpp:72
void SetStops(QGradientStops stops)
Resets Gradient with entries in QGradientStops.
Definition QeLinearGradient.cpp:54
void ResetStopColor()
ResetStartColor resets the value to its default: black (0, 0, 0)
Definition QeLinearGradient.cpp:102
QColor startColor
Start color (0.0) of the gradient.
Definition QeLinearGradient.hpp:28
QeLinearGradient(QWidget *parent=nullptr)
QeLinearGradient default constructor.
Definition QeLinearGradient.cpp:10
bool IsVertical() const
IsVertical returns the value of the vertical property.
Definition QeLinearGradient.cpp:35
void StartColorChanged()
StartColorChanged Signal emitted when StartColor property changes.
void SetVertical(bool newVertical)
SetVertical sets a new state for rendering the gradient.
Definition QeLinearGradient.cpp:40
void ResetStartColor()
ResetStartColor resets the value to its default: white (255, 255, 255)
Definition QeLinearGradient.cpp:82
QColor stopColor
Stop color (1.0) of the gradient.
Definition QeLinearGradient.hpp:34
void ResetVertical()
ResetVertical resets the value to its default: true.
Definition QeLinearGradient.cpp:49
void VerticalChanged()
VerticalChanged Signal emitted when vertical property changes.
bool vertical
Determines if the gradient is drawn vertically or horizontally.
Definition QeLinearGradient.hpp:22