--- /dev/null
+#include "spectrum.h"
+
+SpectrumWidget::SpectrumWidget( QWidget* parent, const char* name )
+ : QWidget( parent,name )
+{
+}
+
+SpectrumWidget::~SpectrumWidget(){}
+
+void SpectrumWidget::paintEvent( QPaintEvent *e )
+{
+ QPainter p;
+ p.begin( this );
+ p.fillRect( 0, 0, width(), height(), paletteBackgroundColor() );
+ drawLines( &p );
+}
+
+void SpectrumWidget::drawLines( QPainter *p )
+{
+ //the spectrum goes from about 780nm to about 400nm
+ //750 is a dark red
+ //660 yellow
+ //580 green
+ //500 light blue
+ //400 dark blue
+
+ QImage img = KImageEffect::gradient ( QSize( width(), height() ), Qt::blue, Qt::red,
+ KImageEffect::HorizontalGradient );
+ QPixmap pm( img );
+
+ p->drawPixmap( width(), height(), pm );
+}
+
+QColor SpectrumWidget::linecolor( double spectrum )
+{
+ QColor c( 128,128,128 );
+ return c;
+}
--- /dev/null
+#include <qwidget.h>
+#include <qcolor.h>
+#include <qpainter.h>
+#include <qimage.h>
+#include <qstring.h>
+#include <qvaluelist.h>
+
+#include <kimageeffect.h>
+#include <kdebug.h>
+#include <kpixmapeffect.h>
+
+
+class SpectrumWidget : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ SpectrumWidget( QWidget *parent, const char* name = 0 );
+ ~SpectrumWidget();
+
+ void setSpectra( QValueList<double> l ){
+ m_spectra = l;
+ }
+
+ private:
+ QValueList<double> m_spectra;
+
+ /**
+ * draws the spectra-lines
+ */
+ void drawLines( QPainter *p );
+
+ /**
+ * @returns the color of a line
+ * @param spectrum the value of the spectrum
+ */
+ QColor linecolor( double spectrum );
+
+ protected:
+ virtual void paintEvent( QPaintEvent *e );
+};