Changeset - 6d13d2fee0f9
[Not reviewed]
default
0 4 0
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-07-23 23:11:55
hy@ozderya.net
fix unzoom with non-autoscaled axis mode
4 files changed with 22 insertions and 2 deletions:
0 comments (0 inline, 0 general)
mainwindow.cpp
Show inline comments
 
@@ -137,6 +137,8 @@ MainWindow::MainWindow(QWidget *parent) 
 
    // init zoomer
 
    zoomer = new Zoomer(ui->plot->canvas(), false);
 
    zoomer->setZoomBase();
 
    QObject::connect(zoomer, &Zoomer::unzoomed,
 
                     this, &MainWindow::unzoomed);
 

	
 
    // init number format
 
    if (numberFormatButtons.checkedId() >= 0)
 
@@ -731,3 +733,18 @@ void MainWindow::messageHandler(QtMsgTyp
 
        ui->statusBar->showMessage(msg, 5000);
 
    }
 
}
 

	
 
void MainWindow::unzoomed()
 
{
 
    if (ui->cbAutoScale->isChecked())
 
    {
 
        ui->plot->setAxisAutoScale(QwtPlot::yLeft);
 
    }
 
    else
 
    {
 
        ui->plot->setAxisScale(QwtPlot::yLeft, ui->spYmin->value(),
 
                               ui->spYmax->value());
 
    }
 
    ui->plot->setAxisAutoScale(QwtPlot::xBottom);
 
    ui->plot->replot();
 
}
mainwindow.h
Show inline comments
 
@@ -87,6 +87,7 @@ private:
 
    void addChannelData(unsigned int channel, DataArray data);
 

	
 
    Zoomer* zoomer;
 
    void unzoomed();
 

	
 
    NumberFormat numberFormat;
 
    unsigned int sampleSize; // number of bytes in the selected number format
zoomer.cpp
Show inline comments
 
@@ -38,7 +38,6 @@ void Zoomer::zoom(int up)
 

	
 
    if (up == 0)
 
    {
 
        this->plot()->setAxisAutoScale(QwtPlot::yLeft);
 
        this->plot()->replot();
 
        emit unzoomed();
 
    }
 
}
zoomer.h
Show inline comments
 
@@ -29,6 +29,9 @@ class Zoomer : public QwtPlotZoomer
 
public:
 
    Zoomer(QWidget *, bool doReplot=true);
 
    void zoom(int up);
 

	
 
signals:
 
    void unzoomed();
 
};
 

	
 
#endif // ZOOMER_H
0 comments (0 inline, 0 general)