PDA

View Full Version : Switching Log and Linear scale, determine which is active



Lovec47
30th October 2014, 08:26
Beginner question, I want to make button to switch between Log and Linear axis. How to determine which transformation is active without declaring new variable ?


void HistPlot::switchLogLin()
{
if(plot->axisScaleDraw(QwtPlot::yLeft)-> ?....== ? )
plot->setAxisScaleEngine(QwtPlot::yLeft, new QwtLogScaleEngine);
else plot->setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
}


Thanks

Martin

Uwe
31st October 2014, 10:56
As long as you have not RTTI disabled:


if ( dynamic_cast<const QwtLogScaleEngine *>( plot->axisScaleEngine( QwtPlot::yLeft ) ) )
...Uwe