@@ -45,6 +45,11 CustomTableModel::CustomTableModel(QObject *parent) : | |||
|
45 | 45 | } |
|
46 | 46 | } |
|
47 | 47 | |
|
48 | CustomTableModel::~CustomTableModel() | |
|
49 | { | |
|
50 | qDeleteAll(m_data); | |
|
51 | } | |
|
52 | ||
|
48 | 53 | int CustomTableModel::rowCount(const QModelIndex &parent) const |
|
49 | 54 | { |
|
50 | 55 | Q_UNUSED(parent) |
@@ -30,6 +30,7 class CustomTableModel : public QAbstractTableModel | |||
|
30 | 30 | Q_OBJECT |
|
31 | 31 | public: |
|
32 | 32 | explicit CustomTableModel(QObject *parent = 0); |
|
33 | virtual ~CustomTableModel(); | |
|
33 | 34 | |
|
34 | 35 | int rowCount(const QModelIndex &parent = QModelIndex()) const; |
|
35 | 36 | int columnCount(const QModelIndex &parent = QModelIndex()) const; |
@@ -19,7 +19,6 | |||
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #include "tablewidget.h" |
|
22 | #include "customtablemodel.h" | |
|
23 | 22 | #include <QtWidgets/QGridLayout> |
|
24 | 23 | #include <QtWidgets/QTableView> |
|
25 | 24 | #include <QtCharts/QChart> |
@@ -40,16 +39,17 TableWidget::TableWidget(QWidget *parent) | |||
|
40 | 39 | // create simple model for storing data |
|
41 | 40 | // user's table data model |
|
42 | 41 | //! [1] |
|
43 |
|
|
|
42 | m_model = new CustomTableModel; | |
|
44 | 43 | //! [1] |
|
45 | 44 | |
|
46 | 45 | //! [2] |
|
47 | 46 | // create table view and add model to it |
|
48 | 47 | QTableView *tableView = new QTableView; |
|
49 | tableView->setModel(model); | |
|
48 | tableView->setModel(m_model); | |
|
50 | 49 | tableView->setMinimumWidth(300); |
|
51 | 50 | tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); |
|
52 | 51 | tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch); |
|
52 | m_model->setParent(tableView); | |
|
53 | 53 | //! [2] |
|
54 | 54 | |
|
55 | 55 | //! [3] |
@@ -69,7 +69,7 TableWidget::TableWidget(QWidget *parent) | |||
|
69 | 69 | mapper->setFirstRow(first); |
|
70 | 70 | mapper->setRowCount(count); |
|
71 | 71 | mapper->setSeries(series); |
|
72 | mapper->setModel(model); | |
|
72 | mapper->setModel(m_model); | |
|
73 | 73 | chart->addSeries(series); |
|
74 | 74 | //! [4] |
|
75 | 75 | |
@@ -81,7 +81,7 TableWidget::TableWidget(QWidget *parent) | |||
|
81 | 81 | QList<QBarSet *> barsets = series->barSets(); |
|
82 | 82 | for (int i = 0; i < barsets.count(); i++) { |
|
83 | 83 | seriesColorHex = "#" + QString::number(barsets.at(i)->brush().color().rgb(), 16).right(6).toUpper(); |
|
84 | model->addMapping(seriesColorHex, QRect(1 + i, first, 1, barsets.at(i)->count())); | |
|
84 | m_model->addMapping(seriesColorHex, QRect(1 + i, first, 1, barsets.at(i)->count())); | |
|
85 | 85 | } |
|
86 | 86 | //! [5] |
|
87 | 87 |
@@ -22,6 +22,7 | |||
|
22 | 22 | #define TABLEWIDGET_H |
|
23 | 23 | |
|
24 | 24 | #include <QtWidgets/QWidget> |
|
25 | #include "customtablemodel.h" | |
|
25 | 26 | |
|
26 | 27 | class TableWidget : public QWidget |
|
27 | 28 | { |
@@ -29,6 +30,9 class TableWidget : public QWidget | |||
|
29 | 30 | |
|
30 | 31 | public: |
|
31 | 32 | TableWidget(QWidget *parent = 0); |
|
33 | ||
|
34 | private: | |
|
35 | CustomTableModel *m_model; | |
|
32 | 36 | }; |
|
33 | 37 | |
|
34 | 38 | #endif // TABLEWIDGET_H |
@@ -32,6 +32,7 QT_CHARTS_BEGIN_NAMESPACE | |||
|
32 | 32 | BoxWhiskersAnimation::BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation) |
|
33 | 33 | : ChartAnimation(box), |
|
34 | 34 | m_box(box), |
|
35 | m_changeAnimation(false), | |
|
35 | 36 | m_boxPlotAnimation(boxPlotAnimation) |
|
36 | 37 | { |
|
37 | 38 | setDuration(ChartAnimationDuration); |
@@ -405,6 +405,8 bool QAbstractBarSeries::append(QList<QBarSet *> sets) | |||
|
405 | 405 | Q_D(QAbstractBarSeries); |
|
406 | 406 | bool success = d->append(sets); |
|
407 | 407 | if (success) { |
|
408 | foreach (QBarSet *set, sets) | |
|
409 | set->setParent(this); | |
|
408 | 410 | emit barsetsAdded(sets); |
|
409 | 411 | emit countChanged(); |
|
410 | 412 | } |
@@ -277,6 +277,7 QBoxSetPrivate::QBoxSetPrivate(const QString label, QBoxSet *parent) : QObject(p | |||
|
277 | 277 | |
|
278 | 278 | QBoxSetPrivate::~QBoxSetPrivate() |
|
279 | 279 | { |
|
280 | delete[] m_values; | |
|
280 | 281 | } |
|
281 | 282 | |
|
282 | 283 | bool QBoxSetPrivate::append(qreal value) |
@@ -140,7 +140,7 QLineSeriesPrivate::QLineSeriesPrivate(QLineSeries *q) | |||
|
140 | 140 | : QXYSeriesPrivate(q) |
|
141 | 141 | { |
|
142 | 142 | |
|
143 |
} |
|
|
143 | } | |
|
144 | 144 | |
|
145 | 145 | void QLineSeriesPrivate::initializeGraphics(QGraphicsItem *parent) |
|
146 | 146 | { |
@@ -769,6 +769,7 QChartPrivate::QChartPrivate(QChart *q, QChart::ChartType type): | |||
|
769 | 769 | |
|
770 | 770 | QChartPrivate::~QChartPrivate() |
|
771 | 771 | { |
|
772 | delete m_themeManager; | |
|
772 | 773 | } |
|
773 | 774 | |
|
774 | 775 | // Hackish solution to the problem of explicitly assigning the default pen/brush/font |
@@ -111,19 +111,20 void tst_ChartDataSet::initTestCase() | |||
|
111 | 111 | |
|
112 | 112 | void tst_ChartDataSet::cleanupTestCase() |
|
113 | 113 | { |
|
114 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
114 | 115 | } |
|
115 | 116 | |
|
116 | 117 | void tst_ChartDataSet::init() |
|
117 | 118 | { |
|
118 |
|
|
|
119 | Q_ASSERT(!m_dataset); | |
|
119 | 120 | m_dataset = new ChartDataSet(0); |
|
120 | 121 | } |
|
121 | 122 | |
|
122 | 123 | |
|
123 | 124 | void tst_ChartDataSet::cleanup() |
|
124 | 125 | { |
|
125 | delete m_dataset; | |
|
126 | m_dataset=0; | |
|
126 | delete m_dataset; | |
|
127 | m_dataset = 0; | |
|
127 | 128 | } |
|
128 | 129 | |
|
129 | 130 | void tst_ChartDataSet::chartdataset_data() |
@@ -209,6 +210,8 void tst_ChartDataSet::removeSeries() | |||
|
209 | 210 | TRY_COMPARE(spy1.count(), 0); |
|
210 | 211 | TRY_COMPARE(spy2.count(), 0); |
|
211 | 212 | TRY_COMPARE(spy3.count(), 1); |
|
213 | ||
|
214 | delete series; | |
|
212 | 215 | } |
|
213 | 216 | |
|
214 | 217 | void tst_ChartDataSet::addAxis_data() |
@@ -272,6 +275,8 void tst_ChartDataSet::removeAxis() | |||
|
272 | 275 | TRY_COMPARE(spy1.count(), 1); |
|
273 | 276 | TRY_COMPARE(spy2.count(), 0); |
|
274 | 277 | TRY_COMPARE(spy3.count(), 0); |
|
278 | ||
|
279 | delete axis; | |
|
275 | 280 | } |
|
276 | 281 | |
|
277 | 282 | void tst_ChartDataSet::attachAxis_data() |
@@ -150,6 +150,7 void tst_Domain::initTestCase() | |||
|
150 | 150 | |
|
151 | 151 | void tst_Domain::cleanupTestCase() |
|
152 | 152 | { |
|
153 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
153 | 154 | } |
|
154 | 155 | |
|
155 | 156 | void tst_Domain::init() |
@@ -449,6 +450,9 void tst_Domain::operatorEquals() | |||
|
449 | 450 | TRY_COMPARE(spy0.count(), 0); |
|
450 | 451 | TRY_COMPARE(spy1.count(), 0); |
|
451 | 452 | TRY_COMPARE(spy2.count(), 0); |
|
453 | ||
|
454 | delete domain1; | |
|
455 | delete domain2; | |
|
452 | 456 | } |
|
453 | 457 | |
|
454 | 458 | void tst_Domain::setRange_data() |
@@ -29,6 +29,7 void tst_QAbstractAxis::initTestCase() | |||
|
29 | 29 | |
|
30 | 30 | void tst_QAbstractAxis::cleanupTestCase() |
|
31 | 31 | { |
|
32 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
32 | 33 | } |
|
33 | 34 | |
|
34 | 35 | void tst_QAbstractAxis::init(QAbstractAxis* axis, QAbstractSeries* series) |
@@ -87,6 +87,7 void tst_QBarCategoriesAxis::initTestCase() | |||
|
87 | 87 | |
|
88 | 88 | void tst_QBarCategoriesAxis::cleanupTestCase() |
|
89 | 89 | { |
|
90 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
90 | 91 | } |
|
91 | 92 | |
|
92 | 93 | void tst_QBarCategoriesAxis::init() |
@@ -76,6 +76,7 class tst_qbarmodelmapper : public QObject | |||
|
76 | 76 | |
|
77 | 77 | QBarSeries *m_series; |
|
78 | 78 | QChart *m_chart; |
|
79 | QChartView *m_chartView; | |
|
79 | 80 | }; |
|
80 | 81 | |
|
81 | 82 | tst_qbarmodelmapper::tst_qbarmodelmapper(): |
@@ -85,7 +86,8 tst_qbarmodelmapper::tst_qbarmodelmapper(): | |||
|
85 | 86 | m_vMapper(0), |
|
86 | 87 | m_hMapper(0), |
|
87 | 88 | m_series(0), |
|
88 | m_chart(0) | |
|
89 | m_chart(0), | |
|
90 | m_chartView(0) | |
|
89 | 91 | { |
|
90 | 92 | } |
|
91 | 93 | |
@@ -146,12 +148,14 void tst_qbarmodelmapper::cleanup() | |||
|
146 | 148 | void tst_qbarmodelmapper::initTestCase() |
|
147 | 149 | { |
|
148 | 150 | m_chart = new QChart; |
|
149 |
|
|
|
150 | chartView->show(); | |
|
151 | m_chartView = new QChartView(m_chart); | |
|
152 | m_chartView->show(); | |
|
151 | 153 | } |
|
152 | 154 | |
|
153 | 155 | void tst_qbarmodelmapper::cleanupTestCase() |
|
154 | 156 | { |
|
157 | delete m_chartView; | |
|
158 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
155 | 159 | } |
|
156 | 160 | |
|
157 | 161 | void tst_qbarmodelmapper::verticalMapper_data() |
@@ -173,22 +177,23 void tst_qbarmodelmapper::verticalMapper() | |||
|
173 | 177 | QFETCH(int, lastBarSetColumn); |
|
174 | 178 | QFETCH(int, expectedBarSetCount); |
|
175 | 179 | |
|
176 |
|
|
|
180 | QBarSeries *series = new QBarSeries; | |
|
177 | 181 | |
|
178 | 182 | QVBarModelMapper *mapper = new QVBarModelMapper; |
|
179 | 183 | mapper->setFirstBarSetColumn(firstBarSetColumn); |
|
180 | 184 | mapper->setLastBarSetColumn(lastBarSetColumn); |
|
181 | 185 | mapper->setModel(m_model); |
|
182 |
mapper->setSeries( |
|
|
186 | mapper->setSeries(series); | |
|
183 | 187 | |
|
184 |
m_chart->addSeries( |
|
|
188 | m_chart->addSeries(series); | |
|
185 | 189 | |
|
186 |
QCOMPARE( |
|
|
190 | QCOMPARE(series->count(), expectedBarSetCount); | |
|
187 | 191 | QCOMPARE(mapper->firstBarSetColumn(), qMax(-1, firstBarSetColumn)); |
|
188 | 192 | QCOMPARE(mapper->lastBarSetColumn(), qMax(-1, lastBarSetColumn)); |
|
189 | 193 | |
|
190 | 194 | delete mapper; |
|
191 | mapper = 0; | |
|
195 | m_chart->removeSeries(series); | |
|
196 | delete series; | |
|
192 | 197 | } |
|
193 | 198 | |
|
194 | 199 | void tst_qbarmodelmapper::verticalMapperCustomMapping_data() |
@@ -216,32 +221,33 void tst_qbarmodelmapper::verticalMapperCustomMapping() | |||
|
216 | 221 | QFETCH(int, expectedBarSetCount); |
|
217 | 222 | QFETCH(int, expectedCount); |
|
218 | 223 | |
|
219 |
|
|
|
224 | QBarSeries *series = new QBarSeries; | |
|
220 | 225 | |
|
221 |
QCOMPARE( |
|
|
226 | QCOMPARE(series->count(), 0); | |
|
222 | 227 | |
|
223 | 228 | QVBarModelMapper *mapper = new QVBarModelMapper; |
|
224 | 229 | mapper->setFirstBarSetColumn(0); |
|
225 | 230 | mapper->setLastBarSetColumn(1); |
|
226 | 231 | mapper->setModel(m_model); |
|
227 |
mapper->setSeries( |
|
|
232 | mapper->setSeries(series); | |
|
228 | 233 | mapper->setFirstRow(first); |
|
229 | 234 | mapper->setRowCount(countLimit); |
|
230 |
m_chart->addSeries( |
|
|
235 | m_chart->addSeries(series); | |
|
231 | 236 | |
|
232 |
QCOMPARE( |
|
|
237 | QCOMPARE(series->count(), expectedBarSetCount); | |
|
233 | 238 | |
|
234 | 239 | if (expectedBarSetCount > 0) |
|
235 |
QCOMPARE( |
|
|
240 | QCOMPARE(series->barSets().first()->count(), expectedCount); | |
|
236 | 241 | |
|
237 | 242 | // change values column mapping to invalid |
|
238 | 243 | mapper->setFirstBarSetColumn(-1); |
|
239 | 244 | mapper->setLastBarSetColumn(1); |
|
240 | 245 | |
|
241 |
QCOMPARE( |
|
|
246 | QCOMPARE(series->count(), 0); | |
|
242 | 247 | |
|
243 | 248 | delete mapper; |
|
244 | mapper = 0; | |
|
249 | m_chart->removeSeries(series); | |
|
250 | delete series; | |
|
245 | 251 | } |
|
246 | 252 | |
|
247 | 253 | void tst_qbarmodelmapper::horizontalMapper_data() |
@@ -263,22 +269,23 void tst_qbarmodelmapper::horizontalMapper() | |||
|
263 | 269 | QFETCH(int, lastBarSetRow); |
|
264 | 270 | QFETCH(int, expectedBarSetCount); |
|
265 | 271 | |
|
266 |
|
|
|
272 | QBarSeries *series = new QBarSeries; | |
|
267 | 273 | |
|
268 | 274 | QHBarModelMapper *mapper = new QHBarModelMapper; |
|
269 | 275 | mapper->setFirstBarSetRow(firstBarSetRow); |
|
270 | 276 | mapper->setLastBarSetRow(lastBarSetRow); |
|
271 | 277 | mapper->setModel(m_model); |
|
272 |
mapper->setSeries( |
|
|
278 | mapper->setSeries(series); | |
|
273 | 279 | |
|
274 |
m_chart->addSeries( |
|
|
280 | m_chart->addSeries(series); | |
|
275 | 281 | |
|
276 |
QCOMPARE( |
|
|
282 | QCOMPARE(series->count(), expectedBarSetCount); | |
|
277 | 283 | QCOMPARE(mapper->firstBarSetRow(), qMax(-1, firstBarSetRow)); |
|
278 | 284 | QCOMPARE(mapper->lastBarSetRow(), qMax(-1, lastBarSetRow)); |
|
279 | 285 | |
|
280 | 286 | delete mapper; |
|
281 | mapper = 0; | |
|
287 | m_chart->removeSeries(series); | |
|
288 | delete series; | |
|
282 | 289 | } |
|
283 | 290 | |
|
284 | 291 | void tst_qbarmodelmapper::horizontalMapperCustomMapping_data() |
@@ -306,32 +313,33 void tst_qbarmodelmapper::horizontalMapperCustomMapping() | |||
|
306 | 313 | QFETCH(int, expectedBarSetCount); |
|
307 | 314 | QFETCH(int, expectedCount); |
|
308 | 315 | |
|
309 |
|
|
|
316 | QBarSeries *series = new QBarSeries; | |
|
310 | 317 | |
|
311 |
QCOMPARE( |
|
|
318 | QCOMPARE(series->count(), 0); | |
|
312 | 319 | |
|
313 | 320 | QHBarModelMapper *mapper = new QHBarModelMapper; |
|
314 | 321 | mapper->setFirstBarSetRow(0); |
|
315 | 322 | mapper->setLastBarSetRow(1); |
|
316 | 323 | mapper->setModel(m_model); |
|
317 |
mapper->setSeries( |
|
|
324 | mapper->setSeries(series); | |
|
318 | 325 | mapper->setFirstColumn(first); |
|
319 | 326 | mapper->setColumnCount(countLimit); |
|
320 |
m_chart->addSeries( |
|
|
327 | m_chart->addSeries(series); | |
|
321 | 328 | |
|
322 |
QCOMPARE( |
|
|
329 | QCOMPARE(series->count(), expectedBarSetCount); | |
|
323 | 330 | |
|
324 | 331 | if (expectedBarSetCount > 0) |
|
325 |
QCOMPARE( |
|
|
332 | QCOMPARE(series->barSets().first()->count(), expectedCount); | |
|
326 | 333 | |
|
327 | 334 | // change values column mapping to invalid |
|
328 | 335 | mapper->setFirstBarSetRow(-1); |
|
329 | 336 | mapper->setLastBarSetRow(1); |
|
330 | 337 | |
|
331 |
QCOMPARE( |
|
|
338 | QCOMPARE(series->count(), 0); | |
|
332 | 339 | |
|
333 | 340 | delete mapper; |
|
334 | mapper = 0; | |
|
341 | m_chart->removeSeries(series); | |
|
342 | delete series; | |
|
335 | 343 | } |
|
336 | 344 | |
|
337 | 345 | void tst_qbarmodelmapper::seriesUpdated() |
@@ -636,6 +644,7 void tst_qbarmodelmapper::verticalMapperSignals() | |||
|
636 | 644 | QCOMPARE(spy4.count(), 1); |
|
637 | 645 | QCOMPARE(spy5.count(), 1); |
|
638 | 646 | |
|
647 | delete mapper; | |
|
639 | 648 | } |
|
640 | 649 | |
|
641 | 650 | void tst_qbarmodelmapper::horizontalMapperSignals() |
@@ -662,6 +671,8 void tst_qbarmodelmapper::horizontalMapperSignals() | |||
|
662 | 671 | QCOMPARE(spy3.count(), 1); |
|
663 | 672 | QCOMPARE(spy4.count(), 1); |
|
664 | 673 | QCOMPARE(spy5.count(), 1); |
|
674 | ||
|
675 | delete mapper; | |
|
665 | 676 | } |
|
666 | 677 | |
|
667 | 678 | QTEST_MAIN(tst_qbarmodelmapper) |
@@ -87,6 +87,7 void tst_QBarSeries::initTestCase() | |||
|
87 | 87 | |
|
88 | 88 | void tst_QBarSeries::cleanupTestCase() |
|
89 | 89 | { |
|
90 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
90 | 91 | } |
|
91 | 92 | |
|
92 | 93 | void tst_QBarSeries::init() |
@@ -121,6 +122,7 void tst_QBarSeries::qbarseries() | |||
|
121 | 122 | { |
|
122 | 123 | QBarSeries *barseries = new QBarSeries(); |
|
123 | 124 | QVERIFY(barseries != 0); |
|
125 | delete barseries; | |
|
124 | 126 | } |
|
125 | 127 | |
|
126 | 128 | void tst_QBarSeries::type_data() |
@@ -281,6 +283,7 void tst_QBarSeries::appendList() | |||
|
281 | 283 | ret = m_barseries->append(invalidList); |
|
282 | 284 | QVERIFY(ret == false); |
|
283 | 285 | QVERIFY(m_barseries->count() == count); |
|
286 | delete invalidList.at(0); | |
|
284 | 287 | |
|
285 | 288 | // Try append list with null pointers (should fail, count remains same) |
|
286 | 289 | QList<QBarSet*> invalidList2; |
@@ -71,6 +71,7 void tst_QBarSet::initTestCase() | |||
|
71 | 71 | |
|
72 | 72 | void tst_QBarSet::cleanupTestCase() |
|
73 | 73 | { |
|
74 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
74 | 75 | } |
|
75 | 76 | |
|
76 | 77 | void tst_QBarSet::init() |
@@ -69,6 +69,7 void tst_QCategoryAxis::initTestCase() | |||
|
69 | 69 | |
|
70 | 70 | void tst_QCategoryAxis::cleanupTestCase() |
|
71 | 71 | { |
|
72 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
72 | 73 | } |
|
73 | 74 | |
|
74 | 75 | void tst_QCategoryAxis::init() |
@@ -125,7 +125,7 void tst_QChart::initTestCase() | |||
|
125 | 125 | |
|
126 | 126 | void tst_QChart::cleanupTestCase() |
|
127 | 127 | { |
|
128 | ||
|
128 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
129 | 129 | } |
|
130 | 130 | |
|
131 | 131 | void tst_QChart::init() |
@@ -197,7 +197,7 void tst_QChart::addSeries_data() | |||
|
197 | 197 | QTest::addColumn<QAbstractSeries *>("series"); |
|
198 | 198 | |
|
199 | 199 | QAbstractSeries* line = new QLineSeries(this); |
|
200 |
QAbstractSeries* area = new QAreaSeries( |
|
|
200 | QAbstractSeries* area = new QAreaSeries(new QLineSeries(this)); | |
|
201 | 201 | QAbstractSeries* scatter = new QScatterSeries(this); |
|
202 | 202 | QAbstractSeries* spline = new QSplineSeries(this); |
|
203 | 203 | |
@@ -240,6 +240,7 void tst_QChart::addSeries() | |||
|
240 | 240 | m_chart->removeSeries(series); |
|
241 | 241 | QVERIFY(!series->chart()); |
|
242 | 242 | QCOMPARE(m_chart->series().count(), 0); |
|
243 | delete series; | |
|
243 | 244 | } |
|
244 | 245 | |
|
245 | 246 | void tst_QChart::animationOptions_data() |
@@ -535,6 +536,7 void tst_QChart::removeSeries() | |||
|
535 | 536 | QVERIFY(m_chart->axisY() != 0); |
|
536 | 537 | QVERIFY(m_chart->axisY(series)==0); |
|
537 | 538 | QCOMPARE(deleteSpy.count(), 0); |
|
539 | delete series; | |
|
538 | 540 | } |
|
539 | 541 | |
|
540 | 542 | void tst_QChart::scroll_right_data() |
@@ -1010,6 +1012,7 void tst_QChart::createDefaultAxesForLineSeries() | |||
|
1010 | 1012 | QCOMPARE(xAxis->max(), overallmaxX); |
|
1011 | 1013 | QCOMPARE(yAxis->min(), overallminY); |
|
1012 | 1014 | QCOMPARE(yAxis->max(), overallmaxY); |
|
1015 | delete chart; | |
|
1013 | 1016 | } |
|
1014 | 1017 | |
|
1015 | 1018 | void tst_QChart::axisPolarOrientation() |
@@ -63,6 +63,7 void tst_QChartView::initTestCase() | |||
|
63 | 63 | |
|
64 | 64 | void tst_QChartView::cleanupTestCase() |
|
65 | 65 | { |
|
66 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
66 | 67 | } |
|
67 | 68 | |
|
68 | 69 | void tst_QChartView::init() |
@@ -69,6 +69,7 void tst_QDateTimeAxis::initTestCase() | |||
|
69 | 69 | |
|
70 | 70 | void tst_QDateTimeAxis::cleanupTestCase() |
|
71 | 71 | { |
|
72 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
72 | 73 | } |
|
73 | 74 | |
|
74 | 75 | void tst_QDateTimeAxis::init() |
@@ -81,6 +81,7 void tst_QHorizontalBarSeries::initTestCase() | |||
|
81 | 81 | |
|
82 | 82 | void tst_QHorizontalBarSeries::cleanupTestCase() |
|
83 | 83 | { |
|
84 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
84 | 85 | } |
|
85 | 86 | |
|
86 | 87 | void tst_QHorizontalBarSeries::init() |
@@ -115,6 +116,7 void tst_QHorizontalBarSeries::qhorizontalbarseries() | |||
|
115 | 116 | { |
|
116 | 117 | QHorizontalBarSeries *barseries = new QHorizontalBarSeries(); |
|
117 | 118 | QVERIFY(barseries != 0); |
|
119 | delete barseries; | |
|
118 | 120 | } |
|
119 | 121 | |
|
120 | 122 | void tst_QHorizontalBarSeries::type_data() |
@@ -246,6 +248,7 void tst_QHorizontalBarSeries::appendList() | |||
|
246 | 248 | ret = m_barseries->append(invalidList); |
|
247 | 249 | QVERIFY(ret == false); |
|
248 | 250 | QVERIFY(m_barseries->count() == count); |
|
251 | delete invalidList.at(0); | |
|
249 | 252 | |
|
250 | 253 | // Try append list with null pointers (should fail, count remains same) |
|
251 | 254 | QList<QBarSet*> invalidList2; |
@@ -65,6 +65,7 void tst_QHorizontalPercentBarSeries::initTestCase() | |||
|
65 | 65 | |
|
66 | 66 | void tst_QHorizontalPercentBarSeries::cleanupTestCase() |
|
67 | 67 | { |
|
68 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
68 | 69 | } |
|
69 | 70 | |
|
70 | 71 | void tst_QHorizontalPercentBarSeries::init() |
@@ -86,6 +87,7 void tst_QHorizontalPercentBarSeries::qhorizontalpercentbarseries() | |||
|
86 | 87 | { |
|
87 | 88 | QHorizontalPercentBarSeries *barseries = new QHorizontalPercentBarSeries(); |
|
88 | 89 | QVERIFY(barseries != 0); |
|
90 | delete barseries; | |
|
89 | 91 | } |
|
90 | 92 | |
|
91 | 93 | void tst_QHorizontalPercentBarSeries::type_data() |
@@ -64,6 +64,7 void tst_QHorizontalStackedBarSeries::initTestCase() | |||
|
64 | 64 | |
|
65 | 65 | void tst_QHorizontalStackedBarSeries::cleanupTestCase() |
|
66 | 66 | { |
|
67 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
67 | 68 | } |
|
68 | 69 | |
|
69 | 70 | void tst_QHorizontalStackedBarSeries::init() |
@@ -85,6 +86,7 void tst_QHorizontalStackedBarSeries::qhorizontalstackedbarseries() | |||
|
85 | 86 | { |
|
86 | 87 | QHorizontalStackedBarSeries *barseries = new QHorizontalStackedBarSeries(); |
|
87 | 88 | QVERIFY(barseries != 0); |
|
89 | delete barseries; | |
|
88 | 90 | } |
|
89 | 91 | |
|
90 | 92 | void tst_QHorizontalStackedBarSeries::type_data() |
@@ -71,6 +71,7 void tst_QLegend::initTestCase() | |||
|
71 | 71 | |
|
72 | 72 | void tst_QLegend::cleanupTestCase() |
|
73 | 73 | { |
|
74 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
74 | 75 | } |
|
75 | 76 | |
|
76 | 77 | void tst_QLegend::init() |
@@ -144,8 +145,8 void tst_QLegend::qareaLegendMarker() | |||
|
144 | 145 | QLegend *legend = m_chart->legend(); |
|
145 | 146 | QAreaSeries *series = new QAreaSeries(); |
|
146 | 147 | |
|
147 | QLineSeries *upper = new QLineSeries(); | |
|
148 | QLineSeries *lower = new QLineSeries(); | |
|
148 | QLineSeries *upper = new QLineSeries(series); | |
|
149 | QLineSeries *lower = new QLineSeries(series); | |
|
149 | 150 | |
|
150 | 151 | upper->append(1,1); |
|
151 | 152 | lower->append(1,0); |
@@ -257,8 +258,8 void tst_QLegend::markers() | |||
|
257 | 258 | m_chart->addSeries(line); |
|
258 | 259 | |
|
259 | 260 | QAreaSeries *area = new QAreaSeries(); |
|
260 | QLineSeries *upper = new QLineSeries(); | |
|
261 | QLineSeries *lower = new QLineSeries(); | |
|
261 | QLineSeries *upper = new QLineSeries(area); | |
|
262 | QLineSeries *lower = new QLineSeries(area); | |
|
262 | 263 | upper->append(1,1); |
|
263 | 264 | lower->append(1,0); |
|
264 | 265 | area->setUpperSeries(upper); |
@@ -294,6 +295,8 void tst_QLegend::addAndRemoveSeries() | |||
|
294 | 295 | |
|
295 | 296 | markers = legend->markers(); |
|
296 | 297 | QVERIFY(markers.count() == 0); |
|
298 | ||
|
299 | delete pie; | |
|
297 | 300 | } |
|
298 | 301 | |
|
299 | 302 | void tst_QLegend::pieMarkerProperties() |
@@ -381,8 +384,8 void tst_QLegend::areaMarkerProperties() | |||
|
381 | 384 | |
|
382 | 385 | QAreaSeries *area = new QAreaSeries(); |
|
383 | 386 | area->setName(QString("Area")); |
|
384 | QLineSeries *upper = new QLineSeries(); | |
|
385 | QLineSeries *lower = new QLineSeries(); | |
|
387 | QLineSeries *upper = new QLineSeries(area); | |
|
388 | QLineSeries *lower = new QLineSeries(area); | |
|
386 | 389 | upper->append(1,1); |
|
387 | 390 | lower->append(1,0); |
|
388 | 391 | area->setUpperSeries(upper); |
@@ -522,8 +525,8 void tst_QLegend::markerSignals() | |||
|
522 | 525 | |
|
523 | 526 | QAreaSeries *area = new QAreaSeries(); |
|
524 | 527 | area->setName(QString("Area 1")); |
|
525 | QLineSeries *upper = new QLineSeries(); | |
|
526 | QLineSeries *lower = new QLineSeries(); | |
|
528 | QLineSeries *upper = new QLineSeries(area); | |
|
529 | QLineSeries *lower = new QLineSeries(area); | |
|
527 | 530 | upper->append(2,2); |
|
528 | 531 | lower->append(1,1); |
|
529 | 532 | area->setUpperSeries(upper); |
@@ -46,6 +46,7 void tst_QLineSeries::initTestCase() | |||
|
46 | 46 | |
|
47 | 47 | void tst_QLineSeries::cleanupTestCase() |
|
48 | 48 | { |
|
49 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
49 | 50 | } |
|
50 | 51 | |
|
51 | 52 | void tst_QLineSeries::init() |
@@ -71,6 +71,7 void tst_QLogValueAxis::initTestCase() | |||
|
71 | 71 | |
|
72 | 72 | void tst_QLogValueAxis::cleanupTestCase() |
|
73 | 73 | { |
|
74 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
74 | 75 | } |
|
75 | 76 | |
|
76 | 77 | void tst_QLogValueAxis::init() |
@@ -65,6 +65,7 void tst_QPercentBarSeries::initTestCase() | |||
|
65 | 65 | |
|
66 | 66 | void tst_QPercentBarSeries::cleanupTestCase() |
|
67 | 67 | { |
|
68 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
68 | 69 | } |
|
69 | 70 | |
|
70 | 71 | void tst_QPercentBarSeries::init() |
@@ -86,6 +87,7 void tst_QPercentBarSeries::qpercentbarseries() | |||
|
86 | 87 | { |
|
87 | 88 | QPercentBarSeries *barseries = new QPercentBarSeries(); |
|
88 | 89 | QVERIFY(barseries != 0); |
|
90 | delete barseries; | |
|
89 | 91 | } |
|
90 | 92 | |
|
91 | 93 | void tst_QPercentBarSeries::type_data() |
@@ -75,6 +75,7 class tst_qpiemodelmapper : public QObject | |||
|
75 | 75 | |
|
76 | 76 | QPieSeries *m_series; |
|
77 | 77 | QChart *m_chart; |
|
78 | QChartView *m_chartView; | |
|
78 | 79 | }; |
|
79 | 80 | |
|
80 | 81 | tst_qpiemodelmapper::tst_qpiemodelmapper(): |
@@ -84,7 +85,8 tst_qpiemodelmapper::tst_qpiemodelmapper(): | |||
|
84 | 85 | m_vMapper(0), |
|
85 | 86 | m_hMapper(0), |
|
86 | 87 | m_series(0), |
|
87 | m_chart(0) | |
|
88 | m_chart(0), | |
|
89 | m_chartView(0) | |
|
88 | 90 | { |
|
89 | 91 | } |
|
90 | 92 | |
@@ -145,13 +147,14 void tst_qpiemodelmapper::cleanup() | |||
|
145 | 147 | void tst_qpiemodelmapper::initTestCase() |
|
146 | 148 | { |
|
147 | 149 | m_chart = new QChart; |
|
148 |
|
|
|
149 | chartView->show(); | |
|
150 | m_chartView = new QChartView(m_chart); | |
|
151 | m_chartView->show(); | |
|
150 | 152 | } |
|
151 | 153 | |
|
152 | 154 | void tst_qpiemodelmapper::cleanupTestCase() |
|
153 | 155 | { |
|
154 | // | |
|
156 | delete m_chartView; | |
|
157 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
155 | 158 | } |
|
156 | 159 | |
|
157 | 160 | void tst_qpiemodelmapper::verticalMapper_data() |
@@ -550,6 +553,7 void tst_qpiemodelmapper::verticalMapperSignals() | |||
|
550 | 553 | QCOMPARE(spy4.count(), 1); |
|
551 | 554 | QCOMPARE(spy5.count(), 1); |
|
552 | 555 | |
|
556 | delete mapper; | |
|
553 | 557 | } |
|
554 | 558 | |
|
555 | 559 | void tst_qpiemodelmapper::horizontalMapperSignals() |
@@ -75,6 +75,7 void tst_qpieseries::initTestCase() | |||
|
75 | 75 | |
|
76 | 76 | void tst_qpieseries::cleanupTestCase() |
|
77 | 77 | { |
|
78 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
78 | 79 | } |
|
79 | 80 | |
|
80 | 81 | void tst_qpieseries::init() |
@@ -57,6 +57,7 void tst_qpieslice::initTestCase() | |||
|
57 | 57 | |
|
58 | 58 | void tst_qpieslice::cleanupTestCase() |
|
59 | 59 | { |
|
60 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
60 | 61 | } |
|
61 | 62 | |
|
62 | 63 | void tst_qpieslice::init() |
@@ -47,6 +47,7 void tst_QScatterSeries::initTestCase() | |||
|
47 | 47 | |
|
48 | 48 | void tst_QScatterSeries::cleanupTestCase() |
|
49 | 49 | { |
|
50 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
50 | 51 | } |
|
51 | 52 | |
|
52 | 53 | void tst_QScatterSeries::init() |
@@ -45,6 +45,7 void tst_QSplineSeries::initTestCase() | |||
|
45 | 45 | |
|
46 | 46 | void tst_QSplineSeries::cleanupTestCase() |
|
47 | 47 | { |
|
48 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
48 | 49 | } |
|
49 | 50 | |
|
50 | 51 | void tst_QSplineSeries::init() |
@@ -64,6 +64,7 void tst_QStackedBarSeries::initTestCase() | |||
|
64 | 64 | |
|
65 | 65 | void tst_QStackedBarSeries::cleanupTestCase() |
|
66 | 66 | { |
|
67 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
67 | 68 | } |
|
68 | 69 | |
|
69 | 70 | void tst_QStackedBarSeries::init() |
@@ -85,6 +86,7 void tst_QStackedBarSeries::qstackedbarseries() | |||
|
85 | 86 | { |
|
86 | 87 | QStackedBarSeries *barseries = new QStackedBarSeries(); |
|
87 | 88 | QVERIFY(barseries != 0); |
|
89 | delete barseries; | |
|
88 | 90 | } |
|
89 | 91 | |
|
90 | 92 | void tst_QStackedBarSeries::type_data() |
@@ -73,6 +73,7 void tst_QValueAxis::initTestCase() | |||
|
73 | 73 | |
|
74 | 74 | void tst_QValueAxis::cleanupTestCase() |
|
75 | 75 | { |
|
76 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
76 | 77 | } |
|
77 | 78 | |
|
78 | 79 | void tst_QValueAxis::init() |
@@ -77,6 +77,7 class tst_qxymodelmapper : public QObject | |||
|
77 | 77 | |
|
78 | 78 | QXYSeries *m_series; |
|
79 | 79 | QChart *m_chart; |
|
80 | QChartView *m_chartView; | |
|
80 | 81 | }; |
|
81 | 82 | |
|
82 | 83 | tst_qxymodelmapper::tst_qxymodelmapper(): |
@@ -86,7 +87,8 tst_qxymodelmapper::tst_qxymodelmapper(): | |||
|
86 | 87 | m_hMapper(0), |
|
87 | 88 | m_vMapper(0), |
|
88 | 89 | m_series(0), |
|
89 | m_chart(0) | |
|
90 | m_chart(0), | |
|
91 | m_chartView(0) | |
|
90 | 92 | { |
|
91 | 93 | } |
|
92 | 94 | |
@@ -147,13 +149,14 void tst_qxymodelmapper::cleanup() | |||
|
147 | 149 | void tst_qxymodelmapper::initTestCase() |
|
148 | 150 | { |
|
149 | 151 | m_chart = newQChartOrQPolarChart(); |
|
150 |
|
|
|
151 | chartView->show(); | |
|
152 | m_chartView = new QChartView(m_chart); | |
|
153 | m_chartView->show(); | |
|
152 | 154 | } |
|
153 | 155 | |
|
154 | 156 | void tst_qxymodelmapper::cleanupTestCase() |
|
155 | 157 | { |
|
156 | // | |
|
158 | delete m_chartView; | |
|
159 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
157 | 160 | } |
|
158 | 161 | |
|
159 | 162 | void tst_qxymodelmapper::verticalMapper_data() |
@@ -552,6 +555,7 void tst_qxymodelmapper::verticalMapperSignals() | |||
|
552 | 555 | QCOMPARE(spy4.count(), 1); |
|
553 | 556 | QCOMPARE(spy5.count(), 1); |
|
554 | 557 | |
|
558 | delete mapper; | |
|
555 | 559 | } |
|
556 | 560 | |
|
557 | 561 | void tst_qxymodelmapper::horizontalMapperSignals() |
@@ -578,6 +582,8 void tst_qxymodelmapper::horizontalMapperSignals() | |||
|
578 | 582 | QCOMPARE(spy3.count(), 1); |
|
579 | 583 | QCOMPARE(spy4.count(), 1); |
|
580 | 584 | QCOMPARE(spy5.count(), 1); |
|
585 | ||
|
586 | delete mapper; | |
|
581 | 587 | } |
|
582 | 588 | |
|
583 | 589 | QTEST_MAIN(tst_qxymodelmapper) |
@@ -28,6 +28,7 void tst_QXYSeries::initTestCase() | |||
|
28 | 28 | |
|
29 | 29 | void tst_QXYSeries::cleanupTestCase() |
|
30 | 30 | { |
|
31 | QTest::qWait(1); // Allow final deleteLaters to run | |
|
31 | 32 | } |
|
32 | 33 | |
|
33 | 34 | void tst_QXYSeries::init() |
@@ -80,6 +80,11 CustomTableModel::CustomTableModel(QObject *parent) : | |||
|
80 | 80 | m_data.append(dataVec_Jun); |
|
81 | 81 | } |
|
82 | 82 | |
|
83 | CustomTableModel::~CustomTableModel() | |
|
84 | { | |
|
85 | qDeleteAll(m_data); | |
|
86 | } | |
|
87 | ||
|
83 | 88 | int CustomTableModel::rowCount(const QModelIndex &parent) const |
|
84 | 89 | { |
|
85 | 90 | Q_UNUSED(parent) |
@@ -30,6 +30,7 class CustomTableModel : public QAbstractTableModel | |||
|
30 | 30 | Q_OBJECT |
|
31 | 31 | public: |
|
32 | 32 | explicit CustomTableModel(QObject *parent = 0); |
|
33 | virtual ~CustomTableModel(); | |
|
33 | 34 | |
|
34 | 35 | int rowCount(const QModelIndex &parent = QModelIndex()) const; |
|
35 | 36 | int columnCount(const QModelIndex &parent = QModelIndex()) const; |
@@ -124,8 +124,8 MainWidget::MainWidget(QWidget *parent) : | |||
|
124 | 124 | initThemeCombo(grid); |
|
125 | 125 | initCheckboxes(grid); |
|
126 | 126 | |
|
127 | m_model = new CustomTableModel(); | |
|
128 | 127 | QTableView *tableView = new QTableView; |
|
128 | m_model = new CustomTableModel(tableView); | |
|
129 | 129 | tableView->setModel(m_model); |
|
130 | 130 | tableView->setMaximumWidth(200); |
|
131 | 131 | grid->addWidget(tableView, m_rowPos++, 0, 3, 2, Qt::AlignLeft); |
General Comments 0
You need to be logged in to leave comments.
Login now