30 Apr 16:02
QwtScaleWidget has wrong scale
From: Klaus Schneider <klaus.schneider <at> iup.uni-heidelberg.de>
Subject: QwtScaleWidget has wrong scale
Newsgroups: gmane.comp.graphics.qwt.general
Date: 2008-04-30 14:06:15 GMT
Subject: QwtScaleWidget has wrong scale
Newsgroups: gmane.comp.graphics.qwt.general
Date: 2008-04-30 14:06:15 GMT
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,
(Continue reading)
RSS Feed