You completely misunderstood Qwt API. I would say you have memory leak which will remain undetectable for most of tools.
QwtPlotMagnifier
should be created once during construction and live as long it is needed.
I check the code and as I suspected QwtPlotMagnifier
uses event filter to process events for the plot. Calling this once in construction time should do the trick:
void Kmh::setupWheelZooming()
{
QwtPlotMagnifier *zoom_x = new QwtPlotMagnifier( canvas() );
QwtPlotMagnifier *zoom_y = new QwtPlotMagnifier( canvas() );
zoom_x->setWheelModifiers(Qt::ShiftModifier);
zoom_x->setAxisEnabled(Qt::XAxis, true);
zoom_x->setAxisEnabled(Qt::YAxis,false);
zoom_y->setWheelModifiers(Qt::ControlModifier);
zoom_y->setAxisEnabled(Qt::XAxis,false);
zoom_y->setAxisEnabled(Qt::YAxis,true);
}
This should do the trick without manual handling of any events.