16 setMinimumWidth(minimumWidth);
21 switch (m_colorFilterMode) {
46 QLabel::paintEvent (event);
49void ViewProfileScale::paintForeground ()
51 if (qGray (m_rgbBackground) < 127) {
53 paintOneSpectrum (QColor (m_rgbBackground), QColor (Qt::white));
56 paintOneSpectrum (QColor (m_rgbBackground), QColor (Qt::black));
60void ViewProfileScale::paintHue ()
65 QLinearGradient gradient (QPointF (0.0,
69 gradient.setColorAt (0.0000, Qt::red);
70 gradient.setColorAt (0.3333, Qt::green);
71 gradient.setColorAt (0.6666, Qt::blue);
72 gradient.setColorAt (1.0000, Qt::red);
74 QPainter painter (
this);
75 painter.setPen (Qt::NoPen);
77 QBrush brush (gradient);
79 painter.setBrush (brush);
86void ViewProfileScale::paintIntensity ()
88 paintOneSpectrum (QColor (Qt::black), QColor (Qt::white));
91void ViewProfileScale::paintOneSpectrum (
const QColor &colorStart,
92 const QColor &colorStop)
94 QLinearGradient gradient (QPointF (0.0,
98 gradient.setColorAt (0, colorStart);
99 gradient.setColorAt (1, colorStop);
101 QPainter painter (
this);
102 painter.setPen (Qt::NoPen);
104 QBrush brush (gradient);
106 painter.setBrush (brush);
113void ViewProfileScale::paintSaturation ()
115 paintOneSpectrum (QColor (Qt::white), QColor (Qt::red));
118void ViewProfileScale::paintValue ()
120 paintOneSpectrum (QColor (Qt::black), QColor (Qt::red));
125 m_rgbBackground = rgbBackground;
130 m_colorFilterMode = colorFilterMode;
@ COLOR_FILTER_MODE_FOREGROUND
@ COLOR_FILTER_MODE_VALUE
@ COLOR_FILTER_MODE_INTENSITY
@ COLOR_FILTER_MODE_SATURATION
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
ViewProfileScale(int minimumWidth, QWidget *parent=0)
Single constructor.
void setBackgroundColor(QRgb rgbBackground)
Save the background color for foreground calculations.
virtual void paintEvent(QPaintEvent *)
Draw the gradient.
void setColorFilterMode(ColorFilterMode colorFilterMode)
Change the gradient type.