diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -157,7 +157,7 @@ MainWindow::MainWindow(QWidget *parent) for (unsigned int i = 0; i < numOfChannels; i++) { channelBuffers.append(new FrameBuffer(numOfSamples)); - curves.append(new QwtPlotCurve()); + curves.append(new QwtPlotCurve(QString("Channel %1").arg(i+1))); curves[i]->setSamples(channelBuffers[i]); curves[i]->setPen(Plot::makeColor(i)); curves[i]->attach(ui->plot); @@ -344,7 +344,7 @@ void MainWindow::onNumOfChannelsChanged( for (unsigned int i = 0; i < numOfChannels - oldNum; i++) { channelBuffers.append(new FrameBuffer(numOfSamples)); - curves.append(new QwtPlotCurve()); + curves.append(new QwtPlotCurve(QString("Channel %1").arg(oldNum+i+1))); curves.last()->setSamples(channelBuffers.last()); curves.last()->setPen(Plot::makeColor(curves.length()-1)); curves.last()->attach(ui->plot); diff --git a/src/plot.cpp b/src/plot.cpp --- a/src/plot.cpp +++ b/src/plot.cpp @@ -39,6 +39,7 @@ Plot::Plot(QWidget* parent) : zoomer.setZoomBase(); grid.attach(this); + legend.attach(this); showGrid(false); darkBackground(false); diff --git a/src/plot.h b/src/plot.h --- a/src/plot.h +++ b/src/plot.h @@ -26,6 +26,7 @@ #include #include #include +#include #include "zoomer.h" #include "scalezoomer.h" @@ -51,6 +52,7 @@ private: ScaleZoomer sZoomer; QwtPlotGrid grid; PlotSnapshotOverlay* snapshotOverlay; + QwtPlotLegendItem legend; QAction _showGridAction; QAction _showMinorGridAction;