diff --git a/main.cpp b/main.cpp index f312013..118cc70 100644 --- a/main.cpp +++ b/main.cpp @@ -13,8 +13,5 @@ int main(int argc, char *argv[]) w.loadImage(fileName); w.show(); - //SpectrumWindow s(&w); - //s.show(); - return a.exec(); } diff --git a/spectrumwindow.cpp b/spectrumwindow.cpp index 37e21f7..30f4279 100644 --- a/spectrumwindow.cpp +++ b/spectrumwindow.cpp @@ -15,9 +15,6 @@ SpectrumWindow::SpectrumWindow(QWidget *parent) : //create a line for the current band bandline = new QCPItemStraightLine(ui->spectrumPlot); ui->spectrumPlot->addItem(bandline); - - - } SpectrumWindow::~SpectrumWindow() @@ -39,11 +36,13 @@ void SpectrumWindow::plotSpectrum(QVector x, QVector y){ ui->spectrumPlot->yAxis->setRange(y_min, y_max); //add the graph to the plot - ui->spectrumPlot->addGraph(); ui->spectrumPlot->graph(0)->setData(x, y); //redraw the plot ui->spectrumPlot->replot(); + + std::cout<<"Items in the plot: "<spectrumPlot->itemCount()<point1->coords().x()<<", "<point1->coords().y()<spectrumPlot->xAxis->setRange(x_min, x_max); ui->spectrumPlot->yAxis->setRange(y_min, y_max); + //add a graph to the plot + ui->spectrumPlot->addGraph(); + //set the initial position of the band line double xmid = (x_max + x_min) / 2; std::cout<<"xmid: "<spectrumPlot && event->type() == QEvent::MouseMove) + /*if(target == ui->spectrumPlot && event->type() == QEvent::MouseMove) { QMouseEvent *_mouseEvent = static_cast(event); @@ -93,8 +95,10 @@ bool SpectrumWindow::eventFilter(QObject *target, QEvent *event) //set the position of the band line bandline->point1->setCoords(x, 0); bandline->point2->setCoords(x, 1); + std::cout<<"coords set to: "<spectrumPlot && event->type() == QEvent::MouseButtonPress) + else */ + if(target == ui->spectrumPlot && event->type() == QEvent::MouseButtonPress) { QMouseEvent *_mouseEvent = static_cast(event); @@ -112,6 +116,10 @@ bool SpectrumWindow::eventFilter(QObject *target, QEvent *event) //set the position of the band line bandline->point1->setCoords(x, 0); bandline->point2->setCoords(x, 1); + std::cout<<"coords set to: "<spectrumPlot->replot(); } diff --git a/win32/hsiview.exe b/win32/hsiview.exe index 0958697..2bb6006 100644 Binary files a/win32/hsiview.exe and b/win32/hsiview.exe differ -- libgit2 0.21.4