@@ -48,7 +48,7 void DrilldownChart::changeSeries(DrilldownBarSeries *series) | |||||
48 | setTitle(series->name()); |
|
48 | setTitle(series->name()); | |
49 | } |
|
49 | } | |
50 |
|
50 | |||
51 |
void DrilldownChart::handleClicked(QBarSet *barset |
|
51 | void DrilldownChart::handleClicked(int index, QBarSet *barset) | |
52 | { |
|
52 | { | |
53 | Q_UNUSED(barset) |
|
53 | Q_UNUSED(barset) | |
54 | DrilldownBarSeries* series = static_cast<DrilldownBarSeries*> (sender()); |
|
54 | DrilldownBarSeries* series = static_cast<DrilldownBarSeries*> (sender()); |
@@ -36,7 +36,7 public: | |||||
36 | void changeSeries(DrilldownBarSeries *series); |
|
36 | void changeSeries(DrilldownBarSeries *series); | |
37 |
|
37 | |||
38 | public Q_SLOTS: |
|
38 | public Q_SLOTS: | |
39 |
void handleClicked(QBarSet *barset |
|
39 | void handleClicked(int index, QBarSet *barset); | |
40 |
|
40 | |||
41 | private: |
|
41 | private: | |
42 | DrilldownBarSeries* m_currentSeries; |
|
42 | DrilldownBarSeries* m_currentSeries; |
@@ -67,12 +67,12 int main(int argc, char *argv[]) | |||||
67 | weeklySeries->setName(QString("Crop by week - " + months.at(month))); |
|
67 | weeklySeries->setName(QString("Crop by week - " + months.at(month))); | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 |
// Use |
|
70 | // Use clicked signal to implement drilldown | |
71 |
QObject::connect(weeklySeries, SIGNAL(clicked(QBarSet* |
|
71 | QObject::connect(weeklySeries, SIGNAL(clicked(int, QBarSet*)), drilldownChart, SLOT(handleClicked(int, QBarSet*))); | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 |
// Enable drilldown from season series using |
|
74 | // Enable drilldown from season series using clicked signal | |
75 |
QObject::connect(seasonSeries, SIGNAL(clicked(QBarSet* |
|
75 | QObject::connect(seasonSeries, SIGNAL(clicked(int, QBarSet*)), drilldownChart, SLOT(handleClicked(int, QBarSet*))); | |
76 | //! [3] |
|
76 | //! [3] | |
77 |
|
77 | |||
78 | //! [4] |
|
78 | //! [4] |
@@ -26,31 +26,39 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
26 |
|
26 | |||
27 | Bar::Bar(QBarSet *barset, int index, QGraphicsItem *parent) : QGraphicsRectItem(parent), |
|
27 | Bar::Bar(QBarSet *barset, int index, QGraphicsItem *parent) : QGraphicsRectItem(parent), | |
28 | m_index(index), |
|
28 | m_index(index), | |
29 | m_barset(barset) |
|
29 | m_barset(barset), | |
|
30 | m_hovering(false) | |||
30 | { |
|
31 | { | |
31 | setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); |
|
32 | setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); | |
32 | setAcceptHoverEvents(true); |
|
33 | setAcceptHoverEvents(true); | |
33 | } |
|
34 | } | |
34 |
|
35 | |||
|
36 | Bar::~Bar() | |||
|
37 | { | |||
|
38 | // End hover event, if bar is deleted during it | |||
|
39 | if (m_hovering) { | |||
|
40 | emit hovered(false, m_barset); | |||
|
41 | } | |||
|
42 | } | |||
|
43 | ||||
35 | void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
44 | void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event) | |
36 | { |
|
45 | { | |
37 | Q_UNUSED(event) |
|
46 | Q_UNUSED(event) | |
38 |
emit clicked(m_ |
|
47 | emit clicked(m_index, m_barset); | |
39 | emit clicked(m_index); |
|
|||
40 | } |
|
48 | } | |
41 |
|
49 | |||
42 | void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event) |
|
50 | void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event) | |
43 | { |
|
51 | { | |
44 | Q_UNUSED(event) |
|
52 | Q_UNUSED(event) | |
45 | emit hovered(m_barset, true); |
|
53 | m_hovering = true; | |
46 | emit hovered(true); |
|
54 | emit hovered(true, m_barset); | |
47 | } |
|
55 | } | |
48 |
|
56 | |||
49 | void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) |
|
57 | void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | |
50 | { |
|
58 | { | |
51 | Q_UNUSED(event) |
|
59 | Q_UNUSED(event) | |
52 | emit hovered(m_barset, false); |
|
60 | m_hovering = false; | |
53 | emit hovered(false); |
|
61 | emit hovered(false, m_barset); | |
54 | } |
|
62 | } | |
55 |
|
63 | |||
56 | #include "moc_bar_p.cpp" |
|
64 | #include "moc_bar_p.cpp" |
@@ -43,6 +43,7 class Bar : public QObject, public QGraphicsRectItem | |||||
43 | Q_OBJECT |
|
43 | Q_OBJECT | |
44 | public: |
|
44 | public: | |
45 | Bar(QBarSet *barset, int index, QGraphicsItem *parent = 0); |
|
45 | Bar(QBarSet *barset, int index, QGraphicsItem *parent = 0); | |
|
46 | ~Bar(); | |||
46 |
|
47 | |||
47 | public: |
|
48 | public: | |
48 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
49 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | |
@@ -50,13 +51,12 public: | |||||
50 | void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); |
|
51 | void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); | |
51 |
|
52 | |||
52 | Q_SIGNALS: |
|
53 | Q_SIGNALS: | |
53 |
void clicked(QBarSet *barset |
|
54 | void clicked(int index, QBarSet *barset); | |
54 |
void hovered(QBarSet *barset |
|
55 | void hovered(bool status, QBarSet *barset); | |
55 | void clicked(int index); |
|
|||
56 | void hovered(bool status); |
|
|||
57 |
|
56 | |||
58 | private: |
|
57 | private: | |
59 | int m_index; |
|
58 | int m_index; | |
|
59 | bool m_hovering; | |||
60 | QBarSet *m_barset; |
|
60 | QBarSet *m_barset; | |
61 | }; |
|
61 | }; | |
62 |
|
62 |
@@ -194,10 +194,10 void BarChartItem::handleDataStructureChanged() | |||||
194 | // Bars |
|
194 | // Bars | |
195 | Bar *bar = new Bar(set,c,this); |
|
195 | Bar *bar = new Bar(set,c,this); | |
196 | m_bars.append(bar); |
|
196 | m_bars.append(bar); | |
197 |
connect(bar, SIGNAL(clicked(QBarSet* |
|
197 | connect(bar, SIGNAL(clicked(int, QBarSet*)), m_series, SIGNAL(clicked(int, QBarSet*))); | |
198 |
connect(bar, SIGNAL(hovered(QBarSet* |
|
198 | connect(bar, SIGNAL(hovered(bool, QBarSet*)), m_series, SIGNAL(hovered(bool, QBarSet*))); | |
199 | connect(bar, SIGNAL(clicked(int)), set, SIGNAL(clicked(int))); |
|
199 | connect(bar, SIGNAL(clicked(int, QBarSet*)), set, SIGNAL(clicked(int))); | |
200 | connect(bar, SIGNAL(hovered(bool)), set, SIGNAL(hovered(bool))); |
|
200 | connect(bar, SIGNAL(hovered(bool, QBarSet*)), set, SIGNAL(hovered(bool))); | |
201 | m_layout.append(QRectF(0, 0, 0, 0)); |
|
201 | m_layout.append(QRectF(0, 0, 0, 0)); | |
202 |
|
202 | |||
203 | // Labels |
|
203 | // Labels |
@@ -94,25 +94,25 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
94 | */ |
|
94 | */ | |
95 |
|
95 | |||
96 | /*! |
|
96 | /*! | |
97 |
\fn void QBarSeries::clicked(QBarSet *barset |
|
97 | \fn void QBarSeries::clicked(int index, QBarSet *barset) | |
98 | The signal is emitted if the user clicks with a mouse on top of QBarSet \a barset. |
|
98 | The signal is emitted if the user clicks with a mouse on top of QBarSet \a barset. | |
99 | Clicked bar inside set is indexed by \a index |
|
99 | Clicked bar inside set is indexed by \a index | |
100 | */ |
|
100 | */ | |
101 | /*! |
|
101 | /*! | |
102 |
\qmlsignal BarSeries::onClicked(BarSet barset |
|
102 | \qmlsignal BarSeries::onClicked(int index, BarSet barset) | |
103 | The signal is emitted if the user clicks with a mouse on top of BarSet. |
|
103 | The signal is emitted if the user clicks with a mouse on top of BarSet. | |
104 | Clicked bar inside set is indexed by \a index |
|
104 | Clicked bar inside set is indexed by \a index | |
105 | */ |
|
105 | */ | |
106 |
|
106 | |||
107 | /*! |
|
107 | /*! | |
108 |
\fn void QBarSeries::hovered(QBarSet* barset |
|
108 | \fn void QBarSeries::hovered(bool status, QBarSet* barset) | |
109 |
|
109 | |||
110 | The signal is emitted if mouse is hovered on top of series. |
|
110 | The signal is emitted if mouse is hovered on top of series. | |
111 | Parameter \a barset is the pointer of barset, where hover happened. |
|
111 | Parameter \a barset is the pointer of barset, where hover happened. | |
112 | Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. |
|
112 | Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. | |
113 | */ |
|
113 | */ | |
114 | /*! |
|
114 | /*! | |
115 |
\qmlsignal BarSeries::onHovered(BarSet barset |
|
115 | \qmlsignal BarSeries::onHovered(bool status, BarSet barset) | |
116 |
|
116 | |||
117 | The signal is emitted if mouse is hovered on top of series. |
|
117 | The signal is emitted if mouse is hovered on top of series. | |
118 | Parameter \a barset is the pointer of barset, where hover happened. |
|
118 | Parameter \a barset is the pointer of barset, where hover happened. |
@@ -61,8 +61,8 protected: | |||||
61 | explicit QBarSeries(QBarSeriesPrivate &d,QObject *parent = 0); |
|
61 | explicit QBarSeries(QBarSeriesPrivate &d,QObject *parent = 0); | |
62 |
|
62 | |||
63 | Q_SIGNALS: |
|
63 | Q_SIGNALS: | |
64 |
void clicked(QBarSet *barset |
|
64 | void clicked(int index, QBarSet *barset); | |
65 |
void hovered( |
|
65 | void hovered(bool status, QBarSet *barset); | |
66 | void countChanged(); |
|
66 | void countChanged(); | |
67 | void labelsVisibleChanged(); |
|
67 | void labelsVisibleChanged(); | |
68 |
|
68 |
@@ -77,7 +77,7 public: | |||||
77 | qreal maxX(); |
|
77 | qreal maxX(); | |
78 |
|
78 | |||
79 | Q_SIGNALS: |
|
79 | Q_SIGNALS: | |
80 |
void clicked(QBarSet *barset |
|
80 | void clicked(int index, QBarSet *barset); | |
81 | void updatedBars(); |
|
81 | void updatedBars(); | |
82 | void restructuredBars(); |
|
82 | void restructuredBars(); | |
83 | void labelsVisibleChanged(bool visible); |
|
83 | void labelsVisibleChanged(bool visible); |
@@ -326,7 +326,7 void tst_QBarSeries::mouseclicked() | |||||
326 | *set2 << QPointF(0.3,10) << QPointF(1.3,10) << QPointF(2.3,10); |
|
326 | *set2 << QPointF(0.3,10) << QPointF(1.3,10) << QPointF(2.3,10); | |
327 | series->append(set2); |
|
327 | series->append(set2); | |
328 |
|
328 | |||
329 |
QSignalSpy seriesSpy(series,SIGNAL(clicked(QBarSet* |
|
329 | QSignalSpy seriesSpy(series,SIGNAL(clicked(int,QBarSet*))); | |
330 | QSignalSpy setSpy1(set1, SIGNAL(clicked(int))); |
|
330 | QSignalSpy setSpy1(set1, SIGNAL(clicked(int))); | |
331 | QSignalSpy setSpy2(set2, SIGNAL(clicked(int))); |
|
331 | QSignalSpy setSpy2(set2, SIGNAL(clicked(int))); | |
332 |
|
332 | |||
@@ -346,9 +346,9 void tst_QBarSeries::mouseclicked() | |||||
346 | QCOMPARE(setSpy2.count(), 0); |
|
346 | QCOMPARE(setSpy2.count(), 0); | |
347 |
|
347 | |||
348 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); |
|
348 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); | |
349 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
349 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
350 |
QVERIFY(seriesSpyArg.at( |
|
350 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
351 |
QVERIFY(seriesSpyArg.at( |
|
351 | QVERIFY(seriesSpyArg.at(0).toInt() == 0); | |
352 |
|
352 | |||
353 | QList<QVariant> setSpyArg = setSpy1.takeFirst(); |
|
353 | QList<QVariant> setSpyArg = setSpy1.takeFirst(); | |
354 | QVERIFY(setSpyArg.at(0).type() == QVariant::Int); |
|
354 | QVERIFY(setSpyArg.at(0).type() == QVariant::Int); | |
@@ -364,9 +364,9 void tst_QBarSeries::mouseclicked() | |||||
364 | QCOMPARE(setSpy2.count(), 0); |
|
364 | QCOMPARE(setSpy2.count(), 0); | |
365 |
|
365 | |||
366 | seriesSpyArg = seriesSpy.takeFirst(); |
|
366 | seriesSpyArg = seriesSpy.takeFirst(); | |
367 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
367 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
368 |
QVERIFY(seriesSpyArg.at( |
|
368 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
369 |
QVERIFY(seriesSpyArg.at( |
|
369 | QVERIFY(seriesSpyArg.at(0).toInt() == 1); | |
370 |
|
370 | |||
371 | setSpyArg = setSpy1.takeFirst(); |
|
371 | setSpyArg = setSpy1.takeFirst(); | |
372 | QVERIFY(setSpyArg.at(0).type() == QVariant::Int); |
|
372 | QVERIFY(setSpyArg.at(0).type() == QVariant::Int); | |
@@ -382,9 +382,9 void tst_QBarSeries::mouseclicked() | |||||
382 | QCOMPARE(setSpy2.count(), 0); |
|
382 | QCOMPARE(setSpy2.count(), 0); | |
383 |
|
383 | |||
384 | seriesSpyArg = seriesSpy.takeFirst(); |
|
384 | seriesSpyArg = seriesSpy.takeFirst(); | |
385 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
385 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
386 |
QVERIFY(seriesSpyArg.at( |
|
386 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
387 |
QVERIFY(seriesSpyArg.at( |
|
387 | QVERIFY(seriesSpyArg.at(0).toInt() == 2); | |
388 |
|
388 | |||
389 | setSpyArg = setSpy1.takeFirst(); |
|
389 | setSpyArg = setSpy1.takeFirst(); | |
390 | QVERIFY(setSpyArg.at(0).type() == QVariant::Int); |
|
390 | QVERIFY(setSpyArg.at(0).type() == QVariant::Int); | |
@@ -400,9 +400,9 void tst_QBarSeries::mouseclicked() | |||||
400 | QCOMPARE(setSpy2.count(), 1); |
|
400 | QCOMPARE(setSpy2.count(), 1); | |
401 |
|
401 | |||
402 | seriesSpyArg = seriesSpy.takeFirst(); |
|
402 | seriesSpyArg = seriesSpy.takeFirst(); | |
403 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
403 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
404 |
QVERIFY(seriesSpyArg.at( |
|
404 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
405 |
QVERIFY(seriesSpyArg.at( |
|
405 | QVERIFY(seriesSpyArg.at(0).toInt() == 0); | |
406 |
|
406 | |||
407 | setSpyArg = setSpy2.takeFirst(); |
|
407 | setSpyArg = setSpy2.takeFirst(); | |
408 | QVERIFY(setSpyArg.at(0).type() == QVariant::Int); |
|
408 | QVERIFY(setSpyArg.at(0).type() == QVariant::Int); | |
@@ -418,9 +418,9 void tst_QBarSeries::mouseclicked() | |||||
418 | QCOMPARE(setSpy2.count(), 1); |
|
418 | QCOMPARE(setSpy2.count(), 1); | |
419 |
|
419 | |||
420 | seriesSpyArg = seriesSpy.takeFirst(); |
|
420 | seriesSpyArg = seriesSpy.takeFirst(); | |
421 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
421 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
422 |
QVERIFY(seriesSpyArg.at( |
|
422 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
423 |
QVERIFY(seriesSpyArg.at( |
|
423 | QVERIFY(seriesSpyArg.at(0).toInt() == 1); | |
424 |
|
424 | |||
425 | setSpyArg = setSpy2.takeFirst(); |
|
425 | setSpyArg = setSpy2.takeFirst(); | |
426 | QVERIFY(setSpyArg.at(0).type() == QVariant::Int); |
|
426 | QVERIFY(setSpyArg.at(0).type() == QVariant::Int); | |
@@ -436,9 +436,9 void tst_QBarSeries::mouseclicked() | |||||
436 | QCOMPARE(setSpy2.count(), 1); |
|
436 | QCOMPARE(setSpy2.count(), 1); | |
437 |
|
437 | |||
438 | seriesSpyArg = seriesSpy.takeFirst(); |
|
438 | seriesSpyArg = seriesSpy.takeFirst(); | |
439 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
439 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
440 |
QVERIFY(seriesSpyArg.at( |
|
440 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
441 |
QVERIFY(seriesSpyArg.at( |
|
441 | QVERIFY(seriesSpyArg.at(0).toInt() == 2); | |
442 |
|
442 | |||
443 | setSpyArg = setSpy2.takeFirst(); |
|
443 | setSpyArg = setSpy2.takeFirst(); | |
444 | QVERIFY(setSpyArg.at(0).type() == QVariant::Int); |
|
444 | QVERIFY(setSpyArg.at(0).type() == QVariant::Int); | |
@@ -462,7 +462,7 void tst_QBarSeries::mousehovered() | |||||
462 | *set2 << QPointF(0.3,10) << QPointF(1.3,10) << QPointF(2.3,10); |
|
462 | *set2 << QPointF(0.3,10) << QPointF(1.3,10) << QPointF(2.3,10); | |
463 | series->append(set2); |
|
463 | series->append(set2); | |
464 |
|
464 | |||
465 |
QSignalSpy seriesSpy(series,SIGNAL(hovered(QBarSet* |
|
465 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*))); | |
466 | QSignalSpy setSpy1(set1, SIGNAL(hovered(bool))); |
|
466 | QSignalSpy setSpy1(set1, SIGNAL(hovered(bool))); | |
467 | QSignalSpy setSpy2(set2, SIGNAL(hovered(bool))); |
|
467 | QSignalSpy setSpy2(set2, SIGNAL(hovered(bool))); | |
468 |
|
468 | |||
@@ -491,9 +491,9 void tst_QBarSeries::mousehovered() | |||||
491 | TRY_COMPARE(setSpy2.count(), 0); |
|
491 | TRY_COMPARE(setSpy2.count(), 0); | |
492 |
|
492 | |||
493 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); |
|
493 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); | |
494 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
494 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
495 |
QVERIFY(seriesSpyArg.at( |
|
495 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
496 |
QVERIFY(seriesSpyArg.at( |
|
496 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
497 |
|
497 | |||
498 | QList<QVariant> setSpyArg = setSpy1.takeFirst(); |
|
498 | QList<QVariant> setSpyArg = setSpy1.takeFirst(); | |
499 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); |
|
499 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |
@@ -508,9 +508,9 void tst_QBarSeries::mousehovered() | |||||
508 |
|
508 | |||
509 | // should leave set1 |
|
509 | // should leave set1 | |
510 | seriesSpyArg = seriesSpy.takeFirst(); |
|
510 | seriesSpyArg = seriesSpy.takeFirst(); | |
511 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
511 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
512 |
QVERIFY(seriesSpyArg.at( |
|
512 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
513 |
QVERIFY(seriesSpyArg.at( |
|
513 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
514 |
|
514 | |||
515 | setSpyArg = setSpy1.takeFirst(); |
|
515 | setSpyArg = setSpy1.takeFirst(); | |
516 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); |
|
516 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |
@@ -518,9 +518,9 void tst_QBarSeries::mousehovered() | |||||
518 |
|
518 | |||
519 | // should enter set2 |
|
519 | // should enter set2 | |
520 | seriesSpyArg = seriesSpy.takeFirst(); |
|
520 | seriesSpyArg = seriesSpy.takeFirst(); | |
521 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
521 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
522 |
QVERIFY(seriesSpyArg.at( |
|
522 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
523 |
QVERIFY(seriesSpyArg.at( |
|
523 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
524 |
|
524 | |||
525 | setSpyArg = setSpy2.takeFirst(); |
|
525 | setSpyArg = setSpy2.takeFirst(); | |
526 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); |
|
526 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |
@@ -535,9 +535,9 void tst_QBarSeries::mousehovered() | |||||
535 |
|
535 | |||
536 | // should leave set2 |
|
536 | // should leave set2 | |
537 | seriesSpyArg = seriesSpy.takeFirst(); |
|
537 | seriesSpyArg = seriesSpy.takeFirst(); | |
538 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
538 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
539 |
QVERIFY(seriesSpyArg.at( |
|
539 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
540 |
QVERIFY(seriesSpyArg.at( |
|
540 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
541 |
|
541 | |||
542 | setSpyArg = setSpy2.takeFirst(); |
|
542 | setSpyArg = setSpy2.takeFirst(); | |
543 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); |
|
543 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); |
@@ -112,7 +112,7 void tst_QGroupedBarSeries::mouseclicked() | |||||
112 | *set2 << 10 << 10 << 10; |
|
112 | *set2 << 10 << 10 << 10; | |
113 | series->append(set2); |
|
113 | series->append(set2); | |
114 |
|
114 | |||
115 |
QSignalSpy seriesSpy(series,SIGNAL(clicked(QBarSet* |
|
115 | QSignalSpy seriesSpy(series,SIGNAL(clicked(int, QBarSet*))); | |
116 |
|
116 | |||
117 | QChartView view(new QChart()); |
|
117 | QChartView view(new QChart()); | |
118 | view.resize(400,300); |
|
118 | view.resize(400,300); | |
@@ -128,9 +128,9 void tst_QGroupedBarSeries::mouseclicked() | |||||
128 | QCOMPARE(seriesSpy.count(), 1); |
|
128 | QCOMPARE(seriesSpy.count(), 1); | |
129 |
|
129 | |||
130 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); |
|
130 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); | |
131 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
131 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
132 |
QVERIFY(seriesSpyArg.at( |
|
132 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
133 |
QVERIFY(seriesSpyArg.at( |
|
133 | QVERIFY(seriesSpyArg.at(0).toInt() == 0); | |
134 |
|
134 | |||
135 | //==================================================================================== |
|
135 | //==================================================================================== | |
136 | // barset 1, category test2 |
|
136 | // barset 1, category test2 | |
@@ -140,9 +140,9 void tst_QGroupedBarSeries::mouseclicked() | |||||
140 | QCOMPARE(seriesSpy.count(), 1); |
|
140 | QCOMPARE(seriesSpy.count(), 1); | |
141 |
|
141 | |||
142 | seriesSpyArg = seriesSpy.takeFirst(); |
|
142 | seriesSpyArg = seriesSpy.takeFirst(); | |
143 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
143 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
144 |
QVERIFY(seriesSpyArg.at( |
|
144 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
145 |
QVERIFY(seriesSpyArg.at( |
|
145 | QVERIFY(seriesSpyArg.at(0).toInt() == 1); | |
146 |
|
146 | |||
147 | //==================================================================================== |
|
147 | //==================================================================================== | |
148 | // barset 1, category test3 |
|
148 | // barset 1, category test3 | |
@@ -152,9 +152,9 void tst_QGroupedBarSeries::mouseclicked() | |||||
152 | QCOMPARE(seriesSpy.count(), 1); |
|
152 | QCOMPARE(seriesSpy.count(), 1); | |
153 |
|
153 | |||
154 | seriesSpyArg = seriesSpy.takeFirst(); |
|
154 | seriesSpyArg = seriesSpy.takeFirst(); | |
155 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
155 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
156 |
QVERIFY(seriesSpyArg.at( |
|
156 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
157 |
QVERIFY(seriesSpyArg.at( |
|
157 | QVERIFY(seriesSpyArg.at(0).toInt() == 2); | |
158 |
|
158 | |||
159 | //==================================================================================== |
|
159 | //==================================================================================== | |
160 | // barset 2, category test1 |
|
160 | // barset 2, category test1 | |
@@ -164,9 +164,9 void tst_QGroupedBarSeries::mouseclicked() | |||||
164 | QCOMPARE(seriesSpy.count(), 1); |
|
164 | QCOMPARE(seriesSpy.count(), 1); | |
165 |
|
165 | |||
166 | seriesSpyArg = seriesSpy.takeFirst(); |
|
166 | seriesSpyArg = seriesSpy.takeFirst(); | |
167 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
167 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
168 |
QVERIFY(seriesSpyArg.at( |
|
168 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
169 |
QVERIFY(seriesSpyArg.at( |
|
169 | QVERIFY(seriesSpyArg.at(0).toInt() == 0); | |
170 |
|
170 | |||
171 | //==================================================================================== |
|
171 | //==================================================================================== | |
172 | // barset 2, category test2 |
|
172 | // barset 2, category test2 | |
@@ -176,9 +176,9 void tst_QGroupedBarSeries::mouseclicked() | |||||
176 | QCOMPARE(seriesSpy.count(), 1); |
|
176 | QCOMPARE(seriesSpy.count(), 1); | |
177 |
|
177 | |||
178 | seriesSpyArg = seriesSpy.takeFirst(); |
|
178 | seriesSpyArg = seriesSpy.takeFirst(); | |
179 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
179 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
180 |
QVERIFY(seriesSpyArg.at( |
|
180 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
181 |
QVERIFY(seriesSpyArg.at( |
|
181 | QVERIFY(seriesSpyArg.at(0).toInt() == 1); | |
182 |
|
182 | |||
183 | //==================================================================================== |
|
183 | //==================================================================================== | |
184 | // barset 2, category test3 |
|
184 | // barset 2, category test3 | |
@@ -188,9 +188,9 void tst_QGroupedBarSeries::mouseclicked() | |||||
188 | QCOMPARE(seriesSpy.count(), 1); |
|
188 | QCOMPARE(seriesSpy.count(), 1); | |
189 |
|
189 | |||
190 | seriesSpyArg = seriesSpy.takeFirst(); |
|
190 | seriesSpyArg = seriesSpy.takeFirst(); | |
191 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
191 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
192 |
QVERIFY(seriesSpyArg.at( |
|
192 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
193 |
QVERIFY(seriesSpyArg.at( |
|
193 | QVERIFY(seriesSpyArg.at(0).toInt() == 2); | |
194 | } |
|
194 | } | |
195 |
|
195 | |||
196 | void tst_QGroupedBarSeries::mousehovered_data() |
|
196 | void tst_QGroupedBarSeries::mousehovered_data() | |
@@ -210,7 +210,7 void tst_QGroupedBarSeries::mousehovered() | |||||
210 | *set2 << 10 << 10 << 10; |
|
210 | *set2 << 10 << 10 << 10; | |
211 | series->append(set2); |
|
211 | series->append(set2); | |
212 |
|
212 | |||
213 |
QSignalSpy seriesSpy(series,SIGNAL(hovered(QBarSet* |
|
213 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool, QBarSet*))); | |
214 |
|
214 | |||
215 | QChartView view(new QChart()); |
|
215 | QChartView view(new QChart()); | |
216 | view.resize(400,300); |
|
216 | view.resize(400,300); | |
@@ -235,9 +235,9 void tst_QGroupedBarSeries::mousehovered() | |||||
235 | TRY_COMPARE(seriesSpy.count(), 1); |
|
235 | TRY_COMPARE(seriesSpy.count(), 1); | |
236 |
|
236 | |||
237 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); |
|
237 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); | |
238 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
238 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
239 |
QVERIFY(seriesSpyArg.at( |
|
239 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
240 |
QVERIFY(seriesSpyArg.at( |
|
240 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
241 |
|
241 | |||
242 | //======================================================================= |
|
242 | //======================================================================= | |
243 | // move mouse from top of set1 to top of set2 |
|
243 | // move mouse from top of set1 to top of set2 | |
@@ -247,15 +247,15 void tst_QGroupedBarSeries::mousehovered() | |||||
247 |
|
247 | |||
248 | // should leave set1 |
|
248 | // should leave set1 | |
249 | seriesSpyArg = seriesSpy.takeFirst(); |
|
249 | seriesSpyArg = seriesSpy.takeFirst(); | |
250 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
250 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
251 |
QVERIFY(seriesSpyArg.at( |
|
251 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
252 |
QVERIFY(seriesSpyArg.at( |
|
252 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
253 |
|
253 | |||
254 | // should enter set2 |
|
254 | // should enter set2 | |
255 | seriesSpyArg = seriesSpy.takeFirst(); |
|
255 | seriesSpyArg = seriesSpy.takeFirst(); | |
256 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
256 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
257 |
QVERIFY(seriesSpyArg.at( |
|
257 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
258 |
QVERIFY(seriesSpyArg.at( |
|
258 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
259 |
|
259 | |||
260 | //======================================================================= |
|
260 | //======================================================================= | |
261 | // move mouse from top of set2 to background |
|
261 | // move mouse from top of set2 to background | |
@@ -266,9 +266,9 void tst_QGroupedBarSeries::mousehovered() | |||||
266 |
|
266 | |||
267 | // should leave set2 |
|
267 | // should leave set2 | |
268 | seriesSpyArg = seriesSpy.takeFirst(); |
|
268 | seriesSpyArg = seriesSpy.takeFirst(); | |
269 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
269 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
270 |
QVERIFY(seriesSpyArg.at( |
|
270 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
271 |
QVERIFY(seriesSpyArg.at( |
|
271 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
272 | } |
|
272 | } | |
273 |
|
273 | |||
274 | QTEST_MAIN(tst_QGroupedBarSeries) |
|
274 | QTEST_MAIN(tst_QGroupedBarSeries) |
@@ -110,7 +110,7 void tst_QPercentBarSeries::mouseclicked() | |||||
110 | *set2 << 10 << 10 << 10; |
|
110 | *set2 << 10 << 10 << 10; | |
111 | series->append(set2); |
|
111 | series->append(set2); | |
112 |
|
112 | |||
113 |
QSignalSpy seriesSpy(series,SIGNAL(clicked(QBarSet* |
|
113 | QSignalSpy seriesSpy(series,SIGNAL(clicked(int, QBarSet*))); | |
114 |
|
114 | |||
115 | QChartView view(new QChart()); |
|
115 | QChartView view(new QChart()); | |
116 | view.resize(400,300); |
|
116 | view.resize(400,300); | |
@@ -126,9 +126,9 void tst_QPercentBarSeries::mouseclicked() | |||||
126 | QCOMPARE(seriesSpy.count(), 1); |
|
126 | QCOMPARE(seriesSpy.count(), 1); | |
127 |
|
127 | |||
128 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); |
|
128 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); | |
129 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
129 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
130 |
QVERIFY(seriesSpyArg.at( |
|
130 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
131 |
QVERIFY(seriesSpyArg.at( |
|
131 | QVERIFY(seriesSpyArg.at(0).toInt() == 0); | |
132 |
|
132 | |||
133 | //==================================================================================== |
|
133 | //==================================================================================== | |
134 | // barset 1, category test2 |
|
134 | // barset 1, category test2 | |
@@ -138,9 +138,9 void tst_QPercentBarSeries::mouseclicked() | |||||
138 | QCOMPARE(seriesSpy.count(), 1); |
|
138 | QCOMPARE(seriesSpy.count(), 1); | |
139 |
|
139 | |||
140 | seriesSpyArg = seriesSpy.takeFirst(); |
|
140 | seriesSpyArg = seriesSpy.takeFirst(); | |
141 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
141 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
142 |
QVERIFY(seriesSpyArg.at( |
|
142 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
143 |
QVERIFY(seriesSpyArg.at( |
|
143 | QVERIFY(seriesSpyArg.at(0).toInt() == 1); | |
144 |
|
144 | |||
145 | //==================================================================================== |
|
145 | //==================================================================================== | |
146 | // barset 1, category test3 |
|
146 | // barset 1, category test3 | |
@@ -150,9 +150,9 void tst_QPercentBarSeries::mouseclicked() | |||||
150 | QCOMPARE(seriesSpy.count(), 1); |
|
150 | QCOMPARE(seriesSpy.count(), 1); | |
151 |
|
151 | |||
152 | seriesSpyArg = seriesSpy.takeFirst(); |
|
152 | seriesSpyArg = seriesSpy.takeFirst(); | |
153 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
153 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
154 |
QVERIFY(seriesSpyArg.at( |
|
154 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
155 |
QVERIFY(seriesSpyArg.at( |
|
155 | QVERIFY(seriesSpyArg.at(0).toInt() == 2); | |
156 |
|
156 | |||
157 | //==================================================================================== |
|
157 | //==================================================================================== | |
158 | // barset 2, category test1 |
|
158 | // barset 2, category test1 | |
@@ -162,9 +162,9 void tst_QPercentBarSeries::mouseclicked() | |||||
162 | QCOMPARE(seriesSpy.count(), 1); |
|
162 | QCOMPARE(seriesSpy.count(), 1); | |
163 |
|
163 | |||
164 | seriesSpyArg = seriesSpy.takeFirst(); |
|
164 | seriesSpyArg = seriesSpy.takeFirst(); | |
165 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
165 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
166 |
QVERIFY(seriesSpyArg.at( |
|
166 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
167 |
QVERIFY(seriesSpyArg.at( |
|
167 | QVERIFY(seriesSpyArg.at(0).toInt() == 0); | |
168 |
|
168 | |||
169 | //==================================================================================== |
|
169 | //==================================================================================== | |
170 | // barset 2, category test2 |
|
170 | // barset 2, category test2 | |
@@ -174,9 +174,9 void tst_QPercentBarSeries::mouseclicked() | |||||
174 | QCOMPARE(seriesSpy.count(), 1); |
|
174 | QCOMPARE(seriesSpy.count(), 1); | |
175 |
|
175 | |||
176 | seriesSpyArg = seriesSpy.takeFirst(); |
|
176 | seriesSpyArg = seriesSpy.takeFirst(); | |
177 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
177 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
178 |
QVERIFY(seriesSpyArg.at( |
|
178 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
179 |
QVERIFY(seriesSpyArg.at( |
|
179 | QVERIFY(seriesSpyArg.at(0).toInt() == 1); | |
180 |
|
180 | |||
181 | //==================================================================================== |
|
181 | //==================================================================================== | |
182 | // barset 2, category test3 |
|
182 | // barset 2, category test3 | |
@@ -186,9 +186,9 void tst_QPercentBarSeries::mouseclicked() | |||||
186 | QCOMPARE(seriesSpy.count(), 1); |
|
186 | QCOMPARE(seriesSpy.count(), 1); | |
187 |
|
187 | |||
188 | seriesSpyArg = seriesSpy.takeFirst(); |
|
188 | seriesSpyArg = seriesSpy.takeFirst(); | |
189 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
189 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
190 |
QVERIFY(seriesSpyArg.at( |
|
190 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
191 |
QVERIFY(seriesSpyArg.at( |
|
191 | QVERIFY(seriesSpyArg.at(0).toInt() == 2); | |
192 | } |
|
192 | } | |
193 |
|
193 | |||
194 | void tst_QPercentBarSeries::mousehovered_data() |
|
194 | void tst_QPercentBarSeries::mousehovered_data() | |
@@ -208,7 +208,7 void tst_QPercentBarSeries::mousehovered() | |||||
208 | *set2 << 10 << 10 << 10; |
|
208 | *set2 << 10 << 10 << 10; | |
209 | series->append(set2); |
|
209 | series->append(set2); | |
210 |
|
210 | |||
211 |
QSignalSpy seriesSpy(series,SIGNAL(hovered(QBarSet* |
|
211 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool, QBarSet*))); | |
212 |
|
212 | |||
213 | QChartView view(new QChart()); |
|
213 | QChartView view(new QChart()); | |
214 | view.resize(400,300); |
|
214 | view.resize(400,300); | |
@@ -231,9 +231,9 void tst_QPercentBarSeries::mousehovered() | |||||
231 | TRY_COMPARE(seriesSpy.count(), 1); |
|
231 | TRY_COMPARE(seriesSpy.count(), 1); | |
232 |
|
232 | |||
233 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); |
|
233 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); | |
234 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
234 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
235 |
QVERIFY(seriesSpyArg.at( |
|
235 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
236 |
QVERIFY(seriesSpyArg.at( |
|
236 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
237 |
|
237 | |||
238 | //======================================================================= |
|
238 | //======================================================================= | |
239 | // move mouse from top of set1 to top of set2 |
|
239 | // move mouse from top of set1 to top of set2 | |
@@ -242,15 +242,15 void tst_QPercentBarSeries::mousehovered() | |||||
242 |
|
242 | |||
243 | // should leave set1 |
|
243 | // should leave set1 | |
244 | seriesSpyArg = seriesSpy.takeFirst(); |
|
244 | seriesSpyArg = seriesSpy.takeFirst(); | |
245 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
245 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
246 |
QVERIFY(seriesSpyArg.at( |
|
246 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
247 |
QVERIFY(seriesSpyArg.at( |
|
247 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
248 |
|
248 | |||
249 | // should enter set2 |
|
249 | // should enter set2 | |
250 | seriesSpyArg = seriesSpy.takeFirst(); |
|
250 | seriesSpyArg = seriesSpy.takeFirst(); | |
251 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
251 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
252 |
QVERIFY(seriesSpyArg.at( |
|
252 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
253 |
QVERIFY(seriesSpyArg.at( |
|
253 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
254 |
|
254 | |||
255 | //======================================================================= |
|
255 | //======================================================================= | |
256 | // move mouse from top of set2 to background |
|
256 | // move mouse from top of set2 to background | |
@@ -259,9 +259,9 void tst_QPercentBarSeries::mousehovered() | |||||
259 |
|
259 | |||
260 | // should leave set2 |
|
260 | // should leave set2 | |
261 | seriesSpyArg = seriesSpy.takeFirst(); |
|
261 | seriesSpyArg = seriesSpy.takeFirst(); | |
262 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
262 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
263 |
QVERIFY(seriesSpyArg.at( |
|
263 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
264 |
QVERIFY(seriesSpyArg.at( |
|
264 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
265 | } |
|
265 | } | |
266 |
|
266 | |||
267 | QTEST_MAIN(tst_QPercentBarSeries) |
|
267 | QTEST_MAIN(tst_QPercentBarSeries) |
@@ -110,7 +110,7 void tst_QStackedBarSeries::mouseclicked() | |||||
110 | *set2 << 10 << 10 << 10; |
|
110 | *set2 << 10 << 10 << 10; | |
111 | series->append(set2); |
|
111 | series->append(set2); | |
112 |
|
112 | |||
113 |
QSignalSpy seriesSpy(series,SIGNAL(clicked(QBarSet* |
|
113 | QSignalSpy seriesSpy(series,SIGNAL(clicked(int, QBarSet*))); | |
114 |
|
114 | |||
115 | QChartView view(new QChart()); |
|
115 | QChartView view(new QChart()); | |
116 | view.resize(400,300); |
|
116 | view.resize(400,300); | |
@@ -126,9 +126,9 void tst_QStackedBarSeries::mouseclicked() | |||||
126 | QCOMPARE(seriesSpy.count(), 1); |
|
126 | QCOMPARE(seriesSpy.count(), 1); | |
127 |
|
127 | |||
128 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); |
|
128 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); | |
129 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
129 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
130 |
QVERIFY(seriesSpyArg.at( |
|
130 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
131 |
QVERIFY(seriesSpyArg.at( |
|
131 | QVERIFY(seriesSpyArg.at(0).toInt() == 0); | |
132 |
|
132 | |||
133 | //==================================================================================== |
|
133 | //==================================================================================== | |
134 | // barset 1, category test2 |
|
134 | // barset 1, category test2 | |
@@ -138,9 +138,9 void tst_QStackedBarSeries::mouseclicked() | |||||
138 | QCOMPARE(seriesSpy.count(), 1); |
|
138 | QCOMPARE(seriesSpy.count(), 1); | |
139 |
|
139 | |||
140 | seriesSpyArg = seriesSpy.takeFirst(); |
|
140 | seriesSpyArg = seriesSpy.takeFirst(); | |
141 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
141 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
142 |
QVERIFY(seriesSpyArg.at( |
|
142 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
143 |
QVERIFY(seriesSpyArg.at( |
|
143 | QVERIFY(seriesSpyArg.at(0).toInt() == 1); | |
144 |
|
144 | |||
145 | //==================================================================================== |
|
145 | //==================================================================================== | |
146 | // barset 1, category test3 |
|
146 | // barset 1, category test3 | |
@@ -150,9 +150,9 void tst_QStackedBarSeries::mouseclicked() | |||||
150 | QCOMPARE(seriesSpy.count(), 1); |
|
150 | QCOMPARE(seriesSpy.count(), 1); | |
151 |
|
151 | |||
152 | seriesSpyArg = seriesSpy.takeFirst(); |
|
152 | seriesSpyArg = seriesSpy.takeFirst(); | |
153 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
153 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
154 |
QVERIFY(seriesSpyArg.at( |
|
154 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
155 |
QVERIFY(seriesSpyArg.at( |
|
155 | QVERIFY(seriesSpyArg.at(0).toInt() == 2); | |
156 |
|
156 | |||
157 | //==================================================================================== |
|
157 | //==================================================================================== | |
158 | // barset 2, category test1 |
|
158 | // barset 2, category test1 | |
@@ -162,9 +162,9 void tst_QStackedBarSeries::mouseclicked() | |||||
162 | QCOMPARE(seriesSpy.count(), 1); |
|
162 | QCOMPARE(seriesSpy.count(), 1); | |
163 |
|
163 | |||
164 | seriesSpyArg = seriesSpy.takeFirst(); |
|
164 | seriesSpyArg = seriesSpy.takeFirst(); | |
165 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
165 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
166 |
QVERIFY(seriesSpyArg.at( |
|
166 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
167 |
QVERIFY(seriesSpyArg.at( |
|
167 | QVERIFY(seriesSpyArg.at(0).toInt() == 0); | |
168 |
|
168 | |||
169 | //==================================================================================== |
|
169 | //==================================================================================== | |
170 | // barset 2, category test2 |
|
170 | // barset 2, category test2 | |
@@ -174,9 +174,9 void tst_QStackedBarSeries::mouseclicked() | |||||
174 | QCOMPARE(seriesSpy.count(), 1); |
|
174 | QCOMPARE(seriesSpy.count(), 1); | |
175 |
|
175 | |||
176 | seriesSpyArg = seriesSpy.takeFirst(); |
|
176 | seriesSpyArg = seriesSpy.takeFirst(); | |
177 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
177 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
178 |
QVERIFY(seriesSpyArg.at( |
|
178 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
179 |
QVERIFY(seriesSpyArg.at( |
|
179 | QVERIFY(seriesSpyArg.at(0).toInt() == 1); | |
180 |
|
180 | |||
181 | //==================================================================================== |
|
181 | //==================================================================================== | |
182 | // barset 2, category test3 |
|
182 | // barset 2, category test3 | |
@@ -186,9 +186,9 void tst_QStackedBarSeries::mouseclicked() | |||||
186 | QCOMPARE(seriesSpy.count(), 1); |
|
186 | QCOMPARE(seriesSpy.count(), 1); | |
187 |
|
187 | |||
188 | seriesSpyArg = seriesSpy.takeFirst(); |
|
188 | seriesSpyArg = seriesSpy.takeFirst(); | |
189 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
189 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
190 |
QVERIFY(seriesSpyArg.at( |
|
190 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); | |
191 |
QVERIFY(seriesSpyArg.at( |
|
191 | QVERIFY(seriesSpyArg.at(0).toInt() == 2); | |
192 | } |
|
192 | } | |
193 |
|
193 | |||
194 | void tst_QStackedBarSeries::mousehovered_data() |
|
194 | void tst_QStackedBarSeries::mousehovered_data() | |
@@ -208,7 +208,7 void tst_QStackedBarSeries::mousehovered() | |||||
208 | *set2 << 10 << 10 << 10; |
|
208 | *set2 << 10 << 10 << 10; | |
209 | series->append(set2); |
|
209 | series->append(set2); | |
210 |
|
210 | |||
211 |
QSignalSpy seriesSpy(series,SIGNAL(hovered(QBarSet* |
|
211 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool, QBarSet*))); | |
212 |
|
212 | |||
213 | QChartView view(new QChart()); |
|
213 | QChartView view(new QChart()); | |
214 | view.resize(400,300); |
|
214 | view.resize(400,300); | |
@@ -231,9 +231,9 void tst_QStackedBarSeries::mousehovered() | |||||
231 | TRY_COMPARE(seriesSpy.count(), 1); |
|
231 | TRY_COMPARE(seriesSpy.count(), 1); | |
232 |
|
232 | |||
233 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); |
|
233 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); | |
234 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
234 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
235 |
QVERIFY(seriesSpyArg.at( |
|
235 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
236 |
QVERIFY(seriesSpyArg.at( |
|
236 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
237 |
|
237 | |||
238 | //======================================================================= |
|
238 | //======================================================================= | |
239 | // move mouse from top of set1 to top of set2 |
|
239 | // move mouse from top of set1 to top of set2 | |
@@ -242,15 +242,15 void tst_QStackedBarSeries::mousehovered() | |||||
242 |
|
242 | |||
243 | // should leave set1 |
|
243 | // should leave set1 | |
244 | seriesSpyArg = seriesSpy.takeFirst(); |
|
244 | seriesSpyArg = seriesSpy.takeFirst(); | |
245 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
245 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
246 |
QVERIFY(seriesSpyArg.at( |
|
246 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
247 |
QVERIFY(seriesSpyArg.at( |
|
247 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
248 |
|
248 | |||
249 | // should enter set2 |
|
249 | // should enter set2 | |
250 | seriesSpyArg = seriesSpy.takeFirst(); |
|
250 | seriesSpyArg = seriesSpy.takeFirst(); | |
251 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
251 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
252 |
QVERIFY(seriesSpyArg.at( |
|
252 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
253 |
QVERIFY(seriesSpyArg.at( |
|
253 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
254 |
|
254 | |||
255 | //======================================================================= |
|
255 | //======================================================================= | |
256 | // move mouse from top of set2 to background |
|
256 | // move mouse from top of set2 to background | |
@@ -259,9 +259,9 void tst_QStackedBarSeries::mousehovered() | |||||
259 |
|
259 | |||
260 | // should leave set2 |
|
260 | // should leave set2 | |
261 | seriesSpyArg = seriesSpy.takeFirst(); |
|
261 | seriesSpyArg = seriesSpy.takeFirst(); | |
262 |
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at( |
|
262 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
263 |
QVERIFY(seriesSpyArg.at( |
|
263 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
264 |
QVERIFY(seriesSpyArg.at( |
|
264 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
265 | } |
|
265 | } | |
266 |
|
266 | |||
267 | QTEST_MAIN(tst_QStackedBarSeries) |
|
267 | QTEST_MAIN(tst_QStackedBarSeries) |
General Comments 0
You need to be logged in to leave comments.
Login now