Hi all,

I'm using the default QwtScaleEngine for my plot, however I do not like the rounding of the numbers that is done for each grid line. The default QwtScaleEngine is trying to put a grid line on 'nice-looking rounded' numbers.
I managed to implement my own implementation of QwtScaleEngine that is not using the rounded numbers. That implementation of QwtScaleEngine is then placing grid lines exactly on the numbers and stepsize that has been specified in the setAxisScale also if those numbers are 'strange' (like for example: top: 132.43 and bottom: 54.32)

Qt Code:
  1. _plot->setAxisScale(QwtPlot::yLeft, bottom, top, (top - bottom) / 10);
To copy to clipboard, switch view to plain text mode 


For this implementation it is 'only' necessary to change the behaviour of 'divideInterval' and 'align'. However because these functions are not defined as virtual, it is also necessary to copy the implementation of 'autoScale', 'divideScale', 'buildTicks', 'buildMinorTicks' and 'buildMajorTicks'.

It would really simplify my implementation if QwtScaleEngine::divideInterval and QwtLinearScaleEngine::align are made 'virtual'.

In that case the implementation becomes:

Qt Code:
  1. class FixedScaleEngine : public QwtLinearScaleEngine {
  2. protected:
  3. double divideInterval(double interval, int numSteps) const
  4. { if (numSteps <= 0) return 0.0;
  5. return interval / numSteps; }
  6. QwtDoubleInterval align(const QwtDoubleInterval & interval, double /* stepSize */) const
  7. { return interval; }
  8. };
To copy to clipboard, switch view to plain text mode 

Can someone make the functions QwtScaleEngine::divideInterval and QwtLinearScaleEngine::align virtual?

Thanks!

By the way, I'm using and have tested this with the SVN revision 443 of Qwt.