Matthias Pospiech | 27 Apr 14:48

Zoomer always zooms to absolute maximum zoom

I am using the example code form the spectrogramm example.
I changed in such a way that it excepts data arrays, which works good 
and has been discussed here as well.

Now I experience that any zoom done in the running programm zoom 
automatically step by step to the maximum zoom, which is basically a 
singel pixel of the data array. The zoom therefore is practically usedless.

Any ideas how to debug this are welcome.

Matthias

Here the code

class MyZoomer: public QwtPlotZoomer
{
public:
    MyZoomer(QwtPlotCanvas* canvas): QwtPlotZoomer(canvas)
    {
        setTrackerMode(QwtPicker::AlwaysOn);
    }

protected:
    virtual QwtText trackerText( const QwtDoublePoint& p ) const
    {
        QwtText t( QwtPlotPicker::trackerText( p ));

        QColor c(Qt::white);
        c.setAlpha(180);
        t.setBackgroundBrush( QBrush(c) );

        return t;
    }
};

void QSpectrogramPlot::setData(double * Array, int sizex, int sizey)
{
    m_RasterData.setData(Array, sizex, sizey);
    m_spectrogram->setData(m_RasterData);
    initZoomer();
}

void QSpectrogramPlot::initZoomer()
{
    // LeftButton for the zooming
    // MidButton for the panning
    // RightButton: zoom out by 1
    // Ctrl+RighButton: zoom out to full size

    QwtPlotZoomer* zoomer = new MyZoomer(qwtPlot->canvas());
    zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
        Qt::RightButton, Qt::ControlModifier);
    zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
        Qt::RightButton);

    QwtPlotPanner *panner = new QwtPlotPanner(qwtPlot->canvas());
    panner->setAxisEnabled(QwtPlot::yRight, false);
    panner->setMouseButton(Qt::MidButton);

    // Avoid jumping when labels with more/less digits
    // appear/disappear when scrolling vertically

    const QFontMetrics fm(qwtPlot->axisWidget(QwtPlot::yLeft)->font());
    QwtScaleDraw *sd = qwtPlot->axisScaleDraw(QwtPlot::yLeft);
    sd->setMinimumExtent( fm.width("100.00") );

    const QColor c(Qt::darkBlue);
    zoomer->setRubberBandPen(c);
    zoomer->setTrackerPen(c);
}

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

Gmane