17 setMinimumWidth(minimumWidth);
22 switch (m_colorFilterMode) {
44 LOG4CPP_ERROR_S ((*
mainCat)) <<
"ViewProfileScale::paintEvent unexpected color filter mode " << m_colorFilterMode;
48 QLabel::paintEvent (event);
51void ViewProfileScale::paintForeground ()
53 if (qGray (m_rgbBackground) < 127) {
55 paintOneSpectrum (QColor (m_rgbBackground), QColor (Qt::white));
58 paintOneSpectrum (QColor (m_rgbBackground), QColor (Qt::black));
62void ViewProfileScale::paintHue ()
67 QLinearGradient gradient (QPointF (0.0,
71 gradient.setColorAt (0.0000, Qt::red);
72 gradient.setColorAt (0.3333, Qt::green);
73 gradient.setColorAt (0.6666, Qt::blue);
74 gradient.setColorAt (1.0000, Qt::red);
76 QPainter painter (
this);
77 painter.setPen (Qt::NoPen);
79 QBrush brush (gradient);
81 painter.setBrush (brush);
88void ViewProfileScale::paintIntensity ()
90 paintOneSpectrum (QColor (Qt::black), QColor (Qt::white));
93void ViewProfileScale::paintOneSpectrum (
const QColor &colorStart,
94 const QColor &colorStop)
96 QLinearGradient gradient (QPointF (0.0,
100 gradient.setColorAt (0, colorStart);
101 gradient.setColorAt (1, colorStop);
103 QPainter painter (
this);
104 painter.setPen (Qt::NoPen);
106 QBrush brush (gradient);
108 painter.setBrush (brush);
115void ViewProfileScale::paintSaturation ()
117 paintOneSpectrum (QColor (Qt::white), QColor (Qt::red));
120void ViewProfileScale::paintValue ()
122 paintOneSpectrum (QColor (Qt::black), QColor (Qt::red));
127 m_rgbBackground = rgbBackground;
132 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.
log4cpp::Category * mainCat
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.
#define LOG4CPP_ERROR_S(logger)