From bc16f3d0a470e4569f89be037a92b757568f51df Mon Sep 17 00:00:00 2001 From: Sean Rhea Date: Sun, 20 Sep 2009 21:34:27 -0700 Subject: [PATCH] delete main window on close ...and set AllPlot's parent so that it gets deleted, too. --- src/AllPlot.cpp | 3 ++- src/AllPlot.h | 2 +- src/MainWindow.cpp | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/AllPlot.cpp b/src/AllPlot.cpp index 7a3e7985d..9bcb5b293 100644 --- a/src/AllPlot.cpp +++ b/src/AllPlot.cpp @@ -170,7 +170,8 @@ max(double a, double b) { if (a > b) return a; else return b; } #define MILES_PER_KM 0.62137119 #define FEET_PER_M 3.2808399 -AllPlot::AllPlot(): +AllPlot::AllPlot(QWidget *parent): + QwtPlot(parent), settings(NULL), unit(0), rideItem(NULL), diff --git a/src/AllPlot.h b/src/AllPlot.h index 23135e0bc..e8b83ac6a 100644 --- a/src/AllPlot.h +++ b/src/AllPlot.h @@ -53,7 +53,7 @@ class AllPlot : public QwtPlot QVector d_mrk; QList zoneLabels; - AllPlot(); + AllPlot(QWidget *parent); int smoothing() const { return smooth; } diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index d018a9e94..9748afe33 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -232,7 +232,7 @@ MainWindow::MainWindow(const QDir &home) : smoothSlider->maximum(), smoothLineEdit)); smoothLayout->addWidget(smoothSlider); - allPlot = new AllPlot(); + allPlot = new AllPlot(this); smoothSlider->setValue(allPlot->smoothing()); smoothLineEdit->setText(QString("%1").arg(allPlot->smoothing())); @@ -618,6 +618,8 @@ MainWindow::MainWindow(const QDir &home) : treeWidget->setCurrentItem(allRides->child(0)); } } + + setAttribute(Qt::WA_DeleteOnClose); } void