diff --git a/examples/charts/barmodelmapper/customtablemodel.cpp b/examples/charts/barmodelmapper/customtablemodel.cpp index e70fdf3..0a53676 100644 --- a/examples/charts/barmodelmapper/customtablemodel.cpp +++ b/examples/charts/barmodelmapper/customtablemodel.cpp @@ -45,6 +45,11 @@ CustomTableModel::CustomTableModel(QObject *parent) : } } +CustomTableModel::~CustomTableModel() +{ + qDeleteAll(m_data); +} + int CustomTableModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent) diff --git a/examples/charts/barmodelmapper/customtablemodel.h b/examples/charts/barmodelmapper/customtablemodel.h index 7294d28..48527e4 100644 --- a/examples/charts/barmodelmapper/customtablemodel.h +++ b/examples/charts/barmodelmapper/customtablemodel.h @@ -30,6 +30,7 @@ class CustomTableModel : public QAbstractTableModel Q_OBJECT public: explicit CustomTableModel(QObject *parent = 0); + virtual ~CustomTableModel(); int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; diff --git a/examples/charts/barmodelmapper/tablewidget.cpp b/examples/charts/barmodelmapper/tablewidget.cpp index ba07e75..8c434da 100644 --- a/examples/charts/barmodelmapper/tablewidget.cpp +++ b/examples/charts/barmodelmapper/tablewidget.cpp @@ -19,7 +19,6 @@ ****************************************************************************/ #include "tablewidget.h" -#include "customtablemodel.h" #include #include #include @@ -40,16 +39,17 @@ TableWidget::TableWidget(QWidget *parent) // create simple model for storing data // user's table data model //! [1] - CustomTableModel *model = new CustomTableModel; + m_model = new CustomTableModel; //! [1] //! [2] // create table view and add model to it QTableView *tableView = new QTableView; - tableView->setModel(model); + tableView->setModel(m_model); tableView->setMinimumWidth(300); tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch); + m_model->setParent(tableView); //! [2] //! [3] @@ -69,7 +69,7 @@ TableWidget::TableWidget(QWidget *parent) mapper->setFirstRow(first); mapper->setRowCount(count); mapper->setSeries(series); - mapper->setModel(model); + mapper->setModel(m_model); chart->addSeries(series); //! [4] @@ -81,7 +81,7 @@ TableWidget::TableWidget(QWidget *parent) QList barsets = series->barSets(); for (int i = 0; i < barsets.count(); i++) { seriesColorHex = "#" + QString::number(barsets.at(i)->brush().color().rgb(), 16).right(6).toUpper(); - model->addMapping(seriesColorHex, QRect(1 + i, first, 1, barsets.at(i)->count())); + m_model->addMapping(seriesColorHex, QRect(1 + i, first, 1, barsets.at(i)->count())); } //! [5] diff --git a/examples/charts/barmodelmapper/tablewidget.h b/examples/charts/barmodelmapper/tablewidget.h index 126d306..d19a00b 100644 --- a/examples/charts/barmodelmapper/tablewidget.h +++ b/examples/charts/barmodelmapper/tablewidget.h @@ -22,6 +22,7 @@ #define TABLEWIDGET_H #include +#include "customtablemodel.h" class TableWidget : public QWidget { @@ -29,6 +30,9 @@ class TableWidget : public QWidget public: TableWidget(QWidget *parent = 0); + +private: + CustomTableModel *m_model; }; #endif // TABLEWIDGET_H diff --git a/src/charts/animations/boxwhiskersanimation.cpp b/src/charts/animations/boxwhiskersanimation.cpp index 201ffb8..72ae7ef 100644 --- a/src/charts/animations/boxwhiskersanimation.cpp +++ b/src/charts/animations/boxwhiskersanimation.cpp @@ -32,6 +32,7 @@ QT_CHARTS_BEGIN_NAMESPACE BoxWhiskersAnimation::BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation) : ChartAnimation(box), m_box(box), + m_changeAnimation(false), m_boxPlotAnimation(boxPlotAnimation) { setDuration(ChartAnimationDuration); diff --git a/src/charts/barchart/qabstractbarseries.cpp b/src/charts/barchart/qabstractbarseries.cpp index 9c11f92..e049ee5 100644 --- a/src/charts/barchart/qabstractbarseries.cpp +++ b/src/charts/barchart/qabstractbarseries.cpp @@ -405,6 +405,8 @@ bool QAbstractBarSeries::append(QList sets) Q_D(QAbstractBarSeries); bool success = d->append(sets); if (success) { + foreach (QBarSet *set, sets) + set->setParent(this); emit barsetsAdded(sets); emit countChanged(); } diff --git a/src/charts/boxplotchart/qboxset.cpp b/src/charts/boxplotchart/qboxset.cpp index d90ad68..007dd3c 100644 --- a/src/charts/boxplotchart/qboxset.cpp +++ b/src/charts/boxplotchart/qboxset.cpp @@ -277,6 +277,7 @@ QBoxSetPrivate::QBoxSetPrivate(const QString label, QBoxSet *parent) : QObject(p QBoxSetPrivate::~QBoxSetPrivate() { + delete[] m_values; } bool QBoxSetPrivate::append(qreal value) diff --git a/src/charts/linechart/qlineseries.cpp b/src/charts/linechart/qlineseries.cpp index 15728db..4f03fce 100644 --- a/src/charts/linechart/qlineseries.cpp +++ b/src/charts/linechart/qlineseries.cpp @@ -140,7 +140,7 @@ QLineSeriesPrivate::QLineSeriesPrivate(QLineSeries *q) : QXYSeriesPrivate(q) { -}; +} void QLineSeriesPrivate::initializeGraphics(QGraphicsItem *parent) { diff --git a/src/charts/qchart.cpp b/src/charts/qchart.cpp index a7f5894..28b4f52 100644 --- a/src/charts/qchart.cpp +++ b/src/charts/qchart.cpp @@ -769,6 +769,7 @@ QChartPrivate::QChartPrivate(QChart *q, QChart::ChartType type): QChartPrivate::~QChartPrivate() { + delete m_themeManager; } // Hackish solution to the problem of explicitly assigning the default pen/brush/font diff --git a/tests/auto/chartdataset/tst_chartdataset.cpp b/tests/auto/chartdataset/tst_chartdataset.cpp index c93a4ce..8a8cc1a 100644 --- a/tests/auto/chartdataset/tst_chartdataset.cpp +++ b/tests/auto/chartdataset/tst_chartdataset.cpp @@ -111,19 +111,20 @@ void tst_ChartDataSet::initTestCase() void tst_ChartDataSet::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_ChartDataSet::init() { - Q_ASSERT(!m_dataset); + Q_ASSERT(!m_dataset); m_dataset = new ChartDataSet(0); } void tst_ChartDataSet::cleanup() { - delete m_dataset; - m_dataset=0; + delete m_dataset; + m_dataset = 0; } void tst_ChartDataSet::chartdataset_data() @@ -209,6 +210,8 @@ void tst_ChartDataSet::removeSeries() TRY_COMPARE(spy1.count(), 0); TRY_COMPARE(spy2.count(), 0); TRY_COMPARE(spy3.count(), 1); + + delete series; } void tst_ChartDataSet::addAxis_data() @@ -272,6 +275,8 @@ void tst_ChartDataSet::removeAxis() TRY_COMPARE(spy1.count(), 1); TRY_COMPARE(spy2.count(), 0); TRY_COMPARE(spy3.count(), 0); + + delete axis; } void tst_ChartDataSet::attachAxis_data() diff --git a/tests/auto/domain/tst_domain.cpp b/tests/auto/domain/tst_domain.cpp index 33b68a1..f701b7d 100644 --- a/tests/auto/domain/tst_domain.cpp +++ b/tests/auto/domain/tst_domain.cpp @@ -150,6 +150,7 @@ void tst_Domain::initTestCase() void tst_Domain::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_Domain::init() @@ -449,6 +450,9 @@ void tst_Domain::operatorEquals() TRY_COMPARE(spy0.count(), 0); TRY_COMPARE(spy1.count(), 0); TRY_COMPARE(spy2.count(), 0); + + delete domain1; + delete domain2; } void tst_Domain::setRange_data() diff --git a/tests/auto/qabstractaxis/tst_qabstractaxis.cpp b/tests/auto/qabstractaxis/tst_qabstractaxis.cpp index 4df2037..31f9034 100644 --- a/tests/auto/qabstractaxis/tst_qabstractaxis.cpp +++ b/tests/auto/qabstractaxis/tst_qabstractaxis.cpp @@ -29,6 +29,7 @@ void tst_QAbstractAxis::initTestCase() void tst_QAbstractAxis::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QAbstractAxis::init(QAbstractAxis* axis, QAbstractSeries* series) diff --git a/tests/auto/qbarcategoryaxis/tst_qbarcategoryaxis.cpp b/tests/auto/qbarcategoryaxis/tst_qbarcategoryaxis.cpp index e9f5352..3775b5c 100644 --- a/tests/auto/qbarcategoryaxis/tst_qbarcategoryaxis.cpp +++ b/tests/auto/qbarcategoryaxis/tst_qbarcategoryaxis.cpp @@ -87,6 +87,7 @@ void tst_QBarCategoriesAxis::initTestCase() void tst_QBarCategoriesAxis::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QBarCategoriesAxis::init() diff --git a/tests/auto/qbarmodelmapper/tst_qbarmodelmapper.cpp b/tests/auto/qbarmodelmapper/tst_qbarmodelmapper.cpp index 7ff67f3..7d0c93b 100644 --- a/tests/auto/qbarmodelmapper/tst_qbarmodelmapper.cpp +++ b/tests/auto/qbarmodelmapper/tst_qbarmodelmapper.cpp @@ -76,6 +76,7 @@ class tst_qbarmodelmapper : public QObject QBarSeries *m_series; QChart *m_chart; + QChartView *m_chartView; }; tst_qbarmodelmapper::tst_qbarmodelmapper(): @@ -85,7 +86,8 @@ tst_qbarmodelmapper::tst_qbarmodelmapper(): m_vMapper(0), m_hMapper(0), m_series(0), - m_chart(0) + m_chart(0), + m_chartView(0) { } @@ -146,12 +148,14 @@ void tst_qbarmodelmapper::cleanup() void tst_qbarmodelmapper::initTestCase() { m_chart = new QChart; - QChartView *chartView = new QChartView(m_chart); - chartView->show(); + m_chartView = new QChartView(m_chart); + m_chartView->show(); } void tst_qbarmodelmapper::cleanupTestCase() { + delete m_chartView; + QTest::qWait(1); // Allow final deleteLaters to run } void tst_qbarmodelmapper::verticalMapper_data() @@ -173,22 +177,23 @@ void tst_qbarmodelmapper::verticalMapper() QFETCH(int, lastBarSetColumn); QFETCH(int, expectedBarSetCount); - m_series = new QBarSeries; + QBarSeries *series = new QBarSeries; QVBarModelMapper *mapper = new QVBarModelMapper; mapper->setFirstBarSetColumn(firstBarSetColumn); mapper->setLastBarSetColumn(lastBarSetColumn); mapper->setModel(m_model); - mapper->setSeries(m_series); + mapper->setSeries(series); - m_chart->addSeries(m_series); + m_chart->addSeries(series); - QCOMPARE(m_series->count(), expectedBarSetCount); + QCOMPARE(series->count(), expectedBarSetCount); QCOMPARE(mapper->firstBarSetColumn(), qMax(-1, firstBarSetColumn)); QCOMPARE(mapper->lastBarSetColumn(), qMax(-1, lastBarSetColumn)); delete mapper; - mapper = 0; + m_chart->removeSeries(series); + delete series; } void tst_qbarmodelmapper::verticalMapperCustomMapping_data() @@ -216,32 +221,33 @@ void tst_qbarmodelmapper::verticalMapperCustomMapping() QFETCH(int, expectedBarSetCount); QFETCH(int, expectedCount); - m_series = new QBarSeries; + QBarSeries *series = new QBarSeries; - QCOMPARE(m_series->count(), 0); + QCOMPARE(series->count(), 0); QVBarModelMapper *mapper = new QVBarModelMapper; mapper->setFirstBarSetColumn(0); mapper->setLastBarSetColumn(1); mapper->setModel(m_model); - mapper->setSeries(m_series); + mapper->setSeries(series); mapper->setFirstRow(first); mapper->setRowCount(countLimit); - m_chart->addSeries(m_series); + m_chart->addSeries(series); - QCOMPARE(m_series->count(), expectedBarSetCount); + QCOMPARE(series->count(), expectedBarSetCount); if (expectedBarSetCount > 0) - QCOMPARE(m_series->barSets().first()->count(), expectedCount); + QCOMPARE(series->barSets().first()->count(), expectedCount); // change values column mapping to invalid mapper->setFirstBarSetColumn(-1); mapper->setLastBarSetColumn(1); - QCOMPARE(m_series->count(), 0); + QCOMPARE(series->count(), 0); delete mapper; - mapper = 0; + m_chart->removeSeries(series); + delete series; } void tst_qbarmodelmapper::horizontalMapper_data() @@ -263,22 +269,23 @@ void tst_qbarmodelmapper::horizontalMapper() QFETCH(int, lastBarSetRow); QFETCH(int, expectedBarSetCount); - m_series = new QBarSeries; + QBarSeries *series = new QBarSeries; QHBarModelMapper *mapper = new QHBarModelMapper; mapper->setFirstBarSetRow(firstBarSetRow); mapper->setLastBarSetRow(lastBarSetRow); mapper->setModel(m_model); - mapper->setSeries(m_series); + mapper->setSeries(series); - m_chart->addSeries(m_series); + m_chart->addSeries(series); - QCOMPARE(m_series->count(), expectedBarSetCount); + QCOMPARE(series->count(), expectedBarSetCount); QCOMPARE(mapper->firstBarSetRow(), qMax(-1, firstBarSetRow)); QCOMPARE(mapper->lastBarSetRow(), qMax(-1, lastBarSetRow)); delete mapper; - mapper = 0; + m_chart->removeSeries(series); + delete series; } void tst_qbarmodelmapper::horizontalMapperCustomMapping_data() @@ -306,32 +313,33 @@ void tst_qbarmodelmapper::horizontalMapperCustomMapping() QFETCH(int, expectedBarSetCount); QFETCH(int, expectedCount); - m_series = new QBarSeries; + QBarSeries *series = new QBarSeries; - QCOMPARE(m_series->count(), 0); + QCOMPARE(series->count(), 0); QHBarModelMapper *mapper = new QHBarModelMapper; mapper->setFirstBarSetRow(0); mapper->setLastBarSetRow(1); mapper->setModel(m_model); - mapper->setSeries(m_series); + mapper->setSeries(series); mapper->setFirstColumn(first); mapper->setColumnCount(countLimit); - m_chart->addSeries(m_series); + m_chart->addSeries(series); - QCOMPARE(m_series->count(), expectedBarSetCount); + QCOMPARE(series->count(), expectedBarSetCount); if (expectedBarSetCount > 0) - QCOMPARE(m_series->barSets().first()->count(), expectedCount); + QCOMPARE(series->barSets().first()->count(), expectedCount); // change values column mapping to invalid mapper->setFirstBarSetRow(-1); mapper->setLastBarSetRow(1); - QCOMPARE(m_series->count(), 0); + QCOMPARE(series->count(), 0); delete mapper; - mapper = 0; + m_chart->removeSeries(series); + delete series; } void tst_qbarmodelmapper::seriesUpdated() @@ -636,6 +644,7 @@ void tst_qbarmodelmapper::verticalMapperSignals() QCOMPARE(spy4.count(), 1); QCOMPARE(spy5.count(), 1); + delete mapper; } void tst_qbarmodelmapper::horizontalMapperSignals() @@ -662,6 +671,8 @@ void tst_qbarmodelmapper::horizontalMapperSignals() QCOMPARE(spy3.count(), 1); QCOMPARE(spy4.count(), 1); QCOMPARE(spy5.count(), 1); + + delete mapper; } QTEST_MAIN(tst_qbarmodelmapper) diff --git a/tests/auto/qbarseries/tst_qbarseries.cpp b/tests/auto/qbarseries/tst_qbarseries.cpp index 57dccb5..029a445 100644 --- a/tests/auto/qbarseries/tst_qbarseries.cpp +++ b/tests/auto/qbarseries/tst_qbarseries.cpp @@ -87,6 +87,7 @@ void tst_QBarSeries::initTestCase() void tst_QBarSeries::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QBarSeries::init() @@ -121,6 +122,7 @@ void tst_QBarSeries::qbarseries() { QBarSeries *barseries = new QBarSeries(); QVERIFY(barseries != 0); + delete barseries; } void tst_QBarSeries::type_data() @@ -281,6 +283,7 @@ void tst_QBarSeries::appendList() ret = m_barseries->append(invalidList); QVERIFY(ret == false); QVERIFY(m_barseries->count() == count); + delete invalidList.at(0); // Try append list with null pointers (should fail, count remains same) QList invalidList2; diff --git a/tests/auto/qbarset/tst_qbarset.cpp b/tests/auto/qbarset/tst_qbarset.cpp index 35a2ee5..bd5481b 100644 --- a/tests/auto/qbarset/tst_qbarset.cpp +++ b/tests/auto/qbarset/tst_qbarset.cpp @@ -71,6 +71,7 @@ void tst_QBarSet::initTestCase() void tst_QBarSet::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QBarSet::init() diff --git a/tests/auto/qcategoryaxis/tst_qcategoryaxis.cpp b/tests/auto/qcategoryaxis/tst_qcategoryaxis.cpp index ff5f3a4..4ed99eb 100644 --- a/tests/auto/qcategoryaxis/tst_qcategoryaxis.cpp +++ b/tests/auto/qcategoryaxis/tst_qcategoryaxis.cpp @@ -69,6 +69,7 @@ void tst_QCategoryAxis::initTestCase() void tst_QCategoryAxis::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QCategoryAxis::init() diff --git a/tests/auto/qchart/tst_qchart.cpp b/tests/auto/qchart/tst_qchart.cpp index bbc9ae1..9601061 100644 --- a/tests/auto/qchart/tst_qchart.cpp +++ b/tests/auto/qchart/tst_qchart.cpp @@ -125,7 +125,7 @@ void tst_QChart::initTestCase() void tst_QChart::cleanupTestCase() { - + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QChart::init() @@ -197,7 +197,7 @@ void tst_QChart::addSeries_data() QTest::addColumn("series"); QAbstractSeries* line = new QLineSeries(this); - QAbstractSeries* area = new QAreaSeries(static_cast(line)); + QAbstractSeries* area = new QAreaSeries(new QLineSeries(this)); QAbstractSeries* scatter = new QScatterSeries(this); QAbstractSeries* spline = new QSplineSeries(this); @@ -240,6 +240,7 @@ void tst_QChart::addSeries() m_chart->removeSeries(series); QVERIFY(!series->chart()); QCOMPARE(m_chart->series().count(), 0); + delete series; } void tst_QChart::animationOptions_data() @@ -535,6 +536,7 @@ void tst_QChart::removeSeries() QVERIFY(m_chart->axisY() != 0); QVERIFY(m_chart->axisY(series)==0); QCOMPARE(deleteSpy.count(), 0); + delete series; } void tst_QChart::scroll_right_data() @@ -1010,6 +1012,7 @@ void tst_QChart::createDefaultAxesForLineSeries() QCOMPARE(xAxis->max(), overallmaxX); QCOMPARE(yAxis->min(), overallminY); QCOMPARE(yAxis->max(), overallmaxY); + delete chart; } void tst_QChart::axisPolarOrientation() diff --git a/tests/auto/qchartview/tst_qchartview.cpp b/tests/auto/qchartview/tst_qchartview.cpp index cf90085..e4c7a8e 100644 --- a/tests/auto/qchartview/tst_qchartview.cpp +++ b/tests/auto/qchartview/tst_qchartview.cpp @@ -63,6 +63,7 @@ void tst_QChartView::initTestCase() void tst_QChartView::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QChartView::init() diff --git a/tests/auto/qdatetimeaxis/tst_qdatetimeaxis.cpp b/tests/auto/qdatetimeaxis/tst_qdatetimeaxis.cpp index e71b9b5..13a17b6 100644 --- a/tests/auto/qdatetimeaxis/tst_qdatetimeaxis.cpp +++ b/tests/auto/qdatetimeaxis/tst_qdatetimeaxis.cpp @@ -69,6 +69,7 @@ void tst_QDateTimeAxis::initTestCase() void tst_QDateTimeAxis::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QDateTimeAxis::init() diff --git a/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp b/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp index af64537..29bb682 100644 --- a/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp +++ b/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp @@ -81,6 +81,7 @@ void tst_QHorizontalBarSeries::initTestCase() void tst_QHorizontalBarSeries::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QHorizontalBarSeries::init() @@ -115,6 +116,7 @@ void tst_QHorizontalBarSeries::qhorizontalbarseries() { QHorizontalBarSeries *barseries = new QHorizontalBarSeries(); QVERIFY(barseries != 0); + delete barseries; } void tst_QHorizontalBarSeries::type_data() @@ -246,6 +248,7 @@ void tst_QHorizontalBarSeries::appendList() ret = m_barseries->append(invalidList); QVERIFY(ret == false); QVERIFY(m_barseries->count() == count); + delete invalidList.at(0); // Try append list with null pointers (should fail, count remains same) QList invalidList2; diff --git a/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp b/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp index d5df8bd..2c3f4bd 100644 --- a/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp +++ b/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp @@ -65,6 +65,7 @@ void tst_QHorizontalPercentBarSeries::initTestCase() void tst_QHorizontalPercentBarSeries::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QHorizontalPercentBarSeries::init() @@ -86,6 +87,7 @@ void tst_QHorizontalPercentBarSeries::qhorizontalpercentbarseries() { QHorizontalPercentBarSeries *barseries = new QHorizontalPercentBarSeries(); QVERIFY(barseries != 0); + delete barseries; } void tst_QHorizontalPercentBarSeries::type_data() diff --git a/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp b/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp index 10dc367..ac6b9b1 100644 --- a/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp +++ b/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp @@ -64,6 +64,7 @@ void tst_QHorizontalStackedBarSeries::initTestCase() void tst_QHorizontalStackedBarSeries::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QHorizontalStackedBarSeries::init() @@ -85,6 +86,7 @@ void tst_QHorizontalStackedBarSeries::qhorizontalstackedbarseries() { QHorizontalStackedBarSeries *barseries = new QHorizontalStackedBarSeries(); QVERIFY(barseries != 0); + delete barseries; } void tst_QHorizontalStackedBarSeries::type_data() diff --git a/tests/auto/qlegend/tst_qlegend.cpp b/tests/auto/qlegend/tst_qlegend.cpp index cc081e1..47d4b1c 100644 --- a/tests/auto/qlegend/tst_qlegend.cpp +++ b/tests/auto/qlegend/tst_qlegend.cpp @@ -71,6 +71,7 @@ void tst_QLegend::initTestCase() void tst_QLegend::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QLegend::init() @@ -144,8 +145,8 @@ void tst_QLegend::qareaLegendMarker() QLegend *legend = m_chart->legend(); QAreaSeries *series = new QAreaSeries(); - QLineSeries *upper = new QLineSeries(); - QLineSeries *lower = new QLineSeries(); + QLineSeries *upper = new QLineSeries(series); + QLineSeries *lower = new QLineSeries(series); upper->append(1,1); lower->append(1,0); @@ -257,8 +258,8 @@ void tst_QLegend::markers() m_chart->addSeries(line); QAreaSeries *area = new QAreaSeries(); - QLineSeries *upper = new QLineSeries(); - QLineSeries *lower = new QLineSeries(); + QLineSeries *upper = new QLineSeries(area); + QLineSeries *lower = new QLineSeries(area); upper->append(1,1); lower->append(1,0); area->setUpperSeries(upper); @@ -294,6 +295,8 @@ void tst_QLegend::addAndRemoveSeries() markers = legend->markers(); QVERIFY(markers.count() == 0); + + delete pie; } void tst_QLegend::pieMarkerProperties() @@ -381,8 +384,8 @@ void tst_QLegend::areaMarkerProperties() QAreaSeries *area = new QAreaSeries(); area->setName(QString("Area")); - QLineSeries *upper = new QLineSeries(); - QLineSeries *lower = new QLineSeries(); + QLineSeries *upper = new QLineSeries(area); + QLineSeries *lower = new QLineSeries(area); upper->append(1,1); lower->append(1,0); area->setUpperSeries(upper); @@ -522,8 +525,8 @@ void tst_QLegend::markerSignals() QAreaSeries *area = new QAreaSeries(); area->setName(QString("Area 1")); - QLineSeries *upper = new QLineSeries(); - QLineSeries *lower = new QLineSeries(); + QLineSeries *upper = new QLineSeries(area); + QLineSeries *lower = new QLineSeries(area); upper->append(2,2); lower->append(1,1); area->setUpperSeries(upper); diff --git a/tests/auto/qlineseries/tst_qlineseries.cpp b/tests/auto/qlineseries/tst_qlineseries.cpp index 10ac896..aea9ccc 100644 --- a/tests/auto/qlineseries/tst_qlineseries.cpp +++ b/tests/auto/qlineseries/tst_qlineseries.cpp @@ -46,6 +46,7 @@ void tst_QLineSeries::initTestCase() void tst_QLineSeries::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QLineSeries::init() diff --git a/tests/auto/qlogvalueaxis/tst_qlogvalueaxis.cpp b/tests/auto/qlogvalueaxis/tst_qlogvalueaxis.cpp index 3e76420..2f57774 100644 --- a/tests/auto/qlogvalueaxis/tst_qlogvalueaxis.cpp +++ b/tests/auto/qlogvalueaxis/tst_qlogvalueaxis.cpp @@ -71,6 +71,7 @@ void tst_QLogValueAxis::initTestCase() void tst_QLogValueAxis::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QLogValueAxis::init() diff --git a/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp b/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp index d5894c2..e4bab70 100644 --- a/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp +++ b/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp @@ -65,6 +65,7 @@ void tst_QPercentBarSeries::initTestCase() void tst_QPercentBarSeries::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QPercentBarSeries::init() @@ -86,6 +87,7 @@ void tst_QPercentBarSeries::qpercentbarseries() { QPercentBarSeries *barseries = new QPercentBarSeries(); QVERIFY(barseries != 0); + delete barseries; } void tst_QPercentBarSeries::type_data() diff --git a/tests/auto/qpiemodelmapper/tst_qpiemodelmapper.cpp b/tests/auto/qpiemodelmapper/tst_qpiemodelmapper.cpp index 704e61d..3cc65d2 100644 --- a/tests/auto/qpiemodelmapper/tst_qpiemodelmapper.cpp +++ b/tests/auto/qpiemodelmapper/tst_qpiemodelmapper.cpp @@ -75,6 +75,7 @@ class tst_qpiemodelmapper : public QObject QPieSeries *m_series; QChart *m_chart; + QChartView *m_chartView; }; tst_qpiemodelmapper::tst_qpiemodelmapper(): @@ -84,7 +85,8 @@ tst_qpiemodelmapper::tst_qpiemodelmapper(): m_vMapper(0), m_hMapper(0), m_series(0), - m_chart(0) + m_chart(0), + m_chartView(0) { } @@ -145,13 +147,14 @@ void tst_qpiemodelmapper::cleanup() void tst_qpiemodelmapper::initTestCase() { m_chart = new QChart; - QChartView *chartView = new QChartView(m_chart); - chartView->show(); + m_chartView = new QChartView(m_chart); + m_chartView->show(); } void tst_qpiemodelmapper::cleanupTestCase() { - // + delete m_chartView; + QTest::qWait(1); // Allow final deleteLaters to run } void tst_qpiemodelmapper::verticalMapper_data() @@ -550,6 +553,7 @@ void tst_qpiemodelmapper::verticalMapperSignals() QCOMPARE(spy4.count(), 1); QCOMPARE(spy5.count(), 1); + delete mapper; } void tst_qpiemodelmapper::horizontalMapperSignals() diff --git a/tests/auto/qpieseries/tst_qpieseries.cpp b/tests/auto/qpieseries/tst_qpieseries.cpp index 7bcb6d6..ce7e8d5 100644 --- a/tests/auto/qpieseries/tst_qpieseries.cpp +++ b/tests/auto/qpieseries/tst_qpieseries.cpp @@ -75,6 +75,7 @@ void tst_qpieseries::initTestCase() void tst_qpieseries::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_qpieseries::init() diff --git a/tests/auto/qpieslice/tst_qpieslice.cpp b/tests/auto/qpieslice/tst_qpieslice.cpp index 7f8887a..16099cf 100644 --- a/tests/auto/qpieslice/tst_qpieslice.cpp +++ b/tests/auto/qpieslice/tst_qpieslice.cpp @@ -57,6 +57,7 @@ void tst_qpieslice::initTestCase() void tst_qpieslice::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_qpieslice::init() diff --git a/tests/auto/qscatterseries/tst_qscatterseries.cpp b/tests/auto/qscatterseries/tst_qscatterseries.cpp index 2c8a210..c68d999 100644 --- a/tests/auto/qscatterseries/tst_qscatterseries.cpp +++ b/tests/auto/qscatterseries/tst_qscatterseries.cpp @@ -47,6 +47,7 @@ void tst_QScatterSeries::initTestCase() void tst_QScatterSeries::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QScatterSeries::init() diff --git a/tests/auto/qsplineseries/tst_qsplineseries.cpp b/tests/auto/qsplineseries/tst_qsplineseries.cpp index 2ab15d0..b72ac81 100644 --- a/tests/auto/qsplineseries/tst_qsplineseries.cpp +++ b/tests/auto/qsplineseries/tst_qsplineseries.cpp @@ -45,6 +45,7 @@ void tst_QSplineSeries::initTestCase() void tst_QSplineSeries::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QSplineSeries::init() diff --git a/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp b/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp index e5dcfa3..a5df87d 100644 --- a/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp +++ b/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp @@ -64,6 +64,7 @@ void tst_QStackedBarSeries::initTestCase() void tst_QStackedBarSeries::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QStackedBarSeries::init() @@ -85,6 +86,7 @@ void tst_QStackedBarSeries::qstackedbarseries() { QStackedBarSeries *barseries = new QStackedBarSeries(); QVERIFY(barseries != 0); + delete barseries; } void tst_QStackedBarSeries::type_data() diff --git a/tests/auto/qvalueaxis/tst_qvalueaxis.cpp b/tests/auto/qvalueaxis/tst_qvalueaxis.cpp index df86c98..b72d2a3 100644 --- a/tests/auto/qvalueaxis/tst_qvalueaxis.cpp +++ b/tests/auto/qvalueaxis/tst_qvalueaxis.cpp @@ -73,6 +73,7 @@ void tst_QValueAxis::initTestCase() void tst_QValueAxis::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QValueAxis::init() diff --git a/tests/auto/qxymodelmapper/tst_qxymodelmapper.cpp b/tests/auto/qxymodelmapper/tst_qxymodelmapper.cpp index 6538da6..9f05416 100644 --- a/tests/auto/qxymodelmapper/tst_qxymodelmapper.cpp +++ b/tests/auto/qxymodelmapper/tst_qxymodelmapper.cpp @@ -77,6 +77,7 @@ class tst_qxymodelmapper : public QObject QXYSeries *m_series; QChart *m_chart; + QChartView *m_chartView; }; tst_qxymodelmapper::tst_qxymodelmapper(): @@ -86,7 +87,8 @@ tst_qxymodelmapper::tst_qxymodelmapper(): m_hMapper(0), m_vMapper(0), m_series(0), - m_chart(0) + m_chart(0), + m_chartView(0) { } @@ -147,13 +149,14 @@ void tst_qxymodelmapper::cleanup() void tst_qxymodelmapper::initTestCase() { m_chart = newQChartOrQPolarChart(); - QChartView *chartView = new QChartView(m_chart); - chartView->show(); + m_chartView = new QChartView(m_chart); + m_chartView->show(); } void tst_qxymodelmapper::cleanupTestCase() { - // + delete m_chartView; + QTest::qWait(1); // Allow final deleteLaters to run } void tst_qxymodelmapper::verticalMapper_data() @@ -552,6 +555,7 @@ void tst_qxymodelmapper::verticalMapperSignals() QCOMPARE(spy4.count(), 1); QCOMPARE(spy5.count(), 1); + delete mapper; } void tst_qxymodelmapper::horizontalMapperSignals() @@ -578,6 +582,8 @@ void tst_qxymodelmapper::horizontalMapperSignals() QCOMPARE(spy3.count(), 1); QCOMPARE(spy4.count(), 1); QCOMPARE(spy5.count(), 1); + + delete mapper; } QTEST_MAIN(tst_qxymodelmapper) diff --git a/tests/auto/qxyseries/tst_qxyseries.cpp b/tests/auto/qxyseries/tst_qxyseries.cpp index c0721a3..27abd71 100644 --- a/tests/auto/qxyseries/tst_qxyseries.cpp +++ b/tests/auto/qxyseries/tst_qxyseries.cpp @@ -28,6 +28,7 @@ void tst_QXYSeries::initTestCase() void tst_QXYSeries::cleanupTestCase() { + QTest::qWait(1); // Allow final deleteLaters to run } void tst_QXYSeries::init() diff --git a/tests/boxplottester/customtablemodel.cpp b/tests/boxplottester/customtablemodel.cpp index 162dfa2..8724dd5 100644 --- a/tests/boxplottester/customtablemodel.cpp +++ b/tests/boxplottester/customtablemodel.cpp @@ -80,6 +80,11 @@ CustomTableModel::CustomTableModel(QObject *parent) : m_data.append(dataVec_Jun); } +CustomTableModel::~CustomTableModel() +{ + qDeleteAll(m_data); +} + int CustomTableModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent) diff --git a/tests/boxplottester/customtablemodel.h b/tests/boxplottester/customtablemodel.h index f520761..0f1fb9d 100644 --- a/tests/boxplottester/customtablemodel.h +++ b/tests/boxplottester/customtablemodel.h @@ -30,6 +30,7 @@ class CustomTableModel : public QAbstractTableModel Q_OBJECT public: explicit CustomTableModel(QObject *parent = 0); + virtual ~CustomTableModel(); int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; diff --git a/tests/boxplottester/mainwidget.cpp b/tests/boxplottester/mainwidget.cpp index 792cdae..784512d 100644 --- a/tests/boxplottester/mainwidget.cpp +++ b/tests/boxplottester/mainwidget.cpp @@ -124,8 +124,8 @@ MainWidget::MainWidget(QWidget *parent) : initThemeCombo(grid); initCheckboxes(grid); - m_model = new CustomTableModel(); QTableView *tableView = new QTableView; + m_model = new CustomTableModel(tableView); tableView->setModel(m_model); tableView->setMaximumWidth(200); grid->addWidget(tableView, m_rowPos++, 0, 3, 2, Qt::AlignLeft);