Skip to content

Commit

Permalink
fixed high CPU load after end of dinamics
Browse files Browse the repository at this point in the history
  • Loading branch information
anisart committed May 13, 2012
1 parent b276752 commit 0a267c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ void MainWindow::solver(double x10, double y10, double z10, double x20, double y
sum2 /= stepCount - 2;
}

void MainWindow::timerEvent(QTimerEvent *)
void MainWindow::timerEvent(QTimerEvent *e)
{
if ((!solved) or (j > stepCount - 2))
if (!solved)
return;
j++;

Expand All @@ -221,7 +221,7 @@ void MainWindow::timerEvent(QTimerEvent *)
x2r.append(x2[l]);
y2r.append(y2[l]);
}
qDebug()<<j;
// qDebug()<<j;

curve4->setSamples(x1r, y1r);
curve4->attach(ui->qwtPlot_4);
Expand All @@ -234,4 +234,10 @@ void MainWindow::timerEvent(QTimerEvent *)
mark2->attach(ui->qwtPlot_4);

ui->qwtPlot_4->replot();

if (j > stepCount - 3)
{
killTimer(e->timerId());
return;
}
}
2 changes: 1 addition & 1 deletion mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class MainWindow : public QMainWindow
void paintGraphs();

protected:
void timerEvent(QTimerEvent *);
void timerEvent(QTimerEvent *e);
};

#endif // MAINWINDOW_H

0 comments on commit 0a267c9

Please sign in to comment.