Changeset - 44b87d87610b
[Not reviewed]
default
0 2 0
Hasan Yavuz Ă–ZDERYA - 11 years ago 2015-03-16 16:41:13
hy@ozderya.net
implemented "Clear" plot button
2 files changed with 14 insertions and 0 deletions:
0 comments (0 inline, 0 general)
mainwindow.cpp
Show inline comments
 
@@ -42,6 +42,9 @@ MainWindow::MainWindow(QWidget *parent) 
 
    QObject::connect(ui->spYmax, SIGNAL(valueChanged(double)),
 
                     this, SLOT(onYScaleChanged()));
 

	
 
    QObject::connect(ui->actionClear, SIGNAL(triggered(bool)),
 
                     this, SLOT(clearPlot()));
 

	
 
    // setup number format buttons
 
    numberFormatButtons.addButton(ui->rbUint8,  NumberFormat_uint8);
 
    numberFormatButtons.addButton(ui->rbUint16, NumberFormat_uint16);
 
@@ -265,6 +268,15 @@ void MainWindow::addData(double data)
 
    ui->plot->replot();
 
}
 

	
 
void MainWindow::clearPlot()
 
{
 
    dataArray.fill(0.0);
 

	
 
    // update plot
 
    curve.setSamples(dataX, dataArray);
 
    ui->plot->replot();
 
}
 

	
 
void MainWindow::onNumOfSamplesChanged(int value)
 
{
 
    unsigned int oldNum = this->numOfSamples;
mainwindow.h
Show inline comments
 
@@ -67,6 +67,8 @@ private slots:
 
    void onNumberFormatButtonToggled(int numberFormatId, bool checked);
 
    void selectNumberFormat(NumberFormat numberFormatId);
 

	
 
    void clearPlot();
 

	
 
signals:
 
    void portToggled(bool open);
 
};
0 comments (0 inline, 0 general)