16 setMinimumWidth(minimumWidth);
21 switch (m_colorFilterMode) {
46 QLabel::paintEvent (event);
49 void ViewProfileScale::paintForeground ()
51 if (qGray (m_rgbBackground) < 127) {
53 paintOneSpectrum (QColor (m_rgbBackground), QColor (Qt::white));
56 paintOneSpectrum (QColor (m_rgbBackground), QColor (Qt::black));
60 void 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);
86 void ViewProfileScale::paintIntensity ()
88 paintOneSpectrum (QColor (Qt::black), QColor (Qt::white));
91 void 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);
113 void ViewProfileScale::paintSaturation ()
115 paintOneSpectrum (QColor (Qt::white), QColor (Qt::red));
118 void ViewProfileScale::paintValue ()
120 paintOneSpectrum (QColor (Qt::black), QColor (Qt::red));
125 m_rgbBackground = rgbBackground;
130 m_colorFilterMode = colorFilterMode;
void setBackgroundColor(QRgb rgbBackground)
Save the background color for foreground calculations.
ViewProfileScale(int minimumWidth, QWidget *parent=0)
Single constructor.
void setColorFilterMode(ColorFilterMode colorFilterMode)
Change the gradient type.
virtual void paintEvent(QPaintEvent *)
Draw the gradient.
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...