Klaus Schneider | 30 Apr 16:02

QwtScaleWidget has wrong scale

Dear all,

I tried to use a QwtScaleWidget stand-alone for a colour bar scale which I 
want to use independently from QwtPlot. I looked into the spectrogram example 
and the Qwt source code and finally tried the following:

   // interval and colour map (from Spectrogram example)
   QwtDoubleInterval interval(0., 10.);
   QwtLinearColorMap colormap(Qt::darkCyan, Qt::red);
   colormap.addColorStop(0.1, Qt::cyan);
   colormap.addColorStop(0.6, Qt::green);
   colormap.addColorStop(0.95, Qt::yellow);
   // Qwt scale widget and stuff
   QwtScaleWidget* scale = new QwtScaleWidget(QwtScaleDraw::RightScale, this);
   QwtLinearScaleEngine se;
   scale->setScaleDiv(se.transformation(),
              se.divideScale(interval.minValue(), interval.maxValue(), 8, 
5)); // as in QwtPlot::Axis
   scale->setColorBarEnabled(true);
   scale->setColorMap(interval, colormap);
   scale->setTitle("Intensity");
   scale->setMargin(2);

Surprisingly, the scale does not start at the end of the colour bar, but has 
some offset, thus the numbers do not correctly correspond to the colours 
(which is, however, correct in the spectrogram example, where a QwtPlot axis 
is used); see attached screen shot of my test application. What have I done 
wrong?

Thanks a lot,
Klaus
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest

Gmane