PDA

View Full Version : Disabling autoscale is not wirking



P@u1
26th July 2011, 16:33
Hi Everyone,

in my program I want to be able to disable the autoscale for the y-axis and reenable it later.
I use a checkbox for this:



//std::vector<QwtPlot*> plots_;
void MainWindow::on_freezeScaleBox_toggled(bool on)
{
for(int i = 0; i < plots_.size(); ++i)
{
plots_[i]->setAxisAutoScale(QwtPlot::yLeft, on);
}
}


When I first disable the autoaxisscale and then add some curves and some data, it is autoscaled anyway...
Any suggestions?

Uwe
27th July 2011, 08:06
It doesn't matter when you attach your plot items - the only situation, where the flag is processed is QwtPlot::replot. If you want to exclude plot items individually from autoscaling do


item->setItemAttribute( QWtPlot::Item::AutoScale, false );Uwe

P@u1
27th July 2011, 09:25
Thx for your help.
The problem was somewhat simpler :D

I just had to replace
"on" with "!on"

Because otherwise the semantics were wrong.