From d73e56958c7d8b8185150caeffe0974c6935ea99 2012-06-28 08:47:03 From: sauimone Date: 2012-06-28 08:47:03 Subject: [PATCH] removed double signal emitting from barseries/set --- diff --git a/examples/stackedbarchartdrilldown/drilldownchart.cpp b/examples/stackedbarchartdrilldown/drilldownchart.cpp index bb777e5..c9d2c40 100644 --- a/examples/stackedbarchartdrilldown/drilldownchart.cpp +++ b/examples/stackedbarchartdrilldown/drilldownchart.cpp @@ -48,7 +48,7 @@ void DrilldownChart::changeSeries(DrilldownBarSeries *series) setTitle(series->name()); } -void DrilldownChart::handleClicked(QBarSet *barset, int index) +void DrilldownChart::handleClicked(int index, QBarSet *barset) { Q_UNUSED(barset) DrilldownBarSeries* series = static_cast (sender()); diff --git a/examples/stackedbarchartdrilldown/drilldownchart.h b/examples/stackedbarchartdrilldown/drilldownchart.h index 7e68b5a..1c2d573 100644 --- a/examples/stackedbarchartdrilldown/drilldownchart.h +++ b/examples/stackedbarchartdrilldown/drilldownchart.h @@ -36,7 +36,7 @@ public: void changeSeries(DrilldownBarSeries *series); public Q_SLOTS: - void handleClicked(QBarSet *barset, int index); + void handleClicked(int index, QBarSet *barset); private: DrilldownBarSeries* m_currentSeries; diff --git a/examples/stackedbarchartdrilldown/main.cpp b/examples/stackedbarchartdrilldown/main.cpp index d05a157..084b235 100644 --- a/examples/stackedbarchartdrilldown/main.cpp +++ b/examples/stackedbarchartdrilldown/main.cpp @@ -67,12 +67,12 @@ int main(int argc, char *argv[]) weeklySeries->setName(QString("Crop by week - " + months.at(month))); } - // Use right click signal to implement drilldown - QObject::connect(weeklySeries, SIGNAL(clicked(QBarSet*,int)), drilldownChart, SLOT(handleClicked(QBarSet*,int))); + // Use clicked signal to implement drilldown + QObject::connect(weeklySeries, SIGNAL(clicked(int, QBarSet*)), drilldownChart, SLOT(handleClicked(int, QBarSet*))); } - // Enable drilldown from season series using right click. - QObject::connect(seasonSeries, SIGNAL(clicked(QBarSet*,int)), drilldownChart, SLOT(handleClicked(QBarSet*,int))); + // Enable drilldown from season series using clicked signal + QObject::connect(seasonSeries, SIGNAL(clicked(int, QBarSet*)), drilldownChart, SLOT(handleClicked(int, QBarSet*))); //! [3] //! [4] diff --git a/src/barchart/bar.cpp b/src/barchart/bar.cpp index dc3022d..b9055d3 100644 --- a/src/barchart/bar.cpp +++ b/src/barchart/bar.cpp @@ -26,31 +26,39 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE Bar::Bar(QBarSet *barset, int index, QGraphicsItem *parent) : QGraphicsRectItem(parent), m_index(index), - m_barset(barset) + m_barset(barset), + m_hovering(false) { setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); setAcceptHoverEvents(true); } +Bar::~Bar() +{ + // End hover event, if bar is deleted during it + if (m_hovering) { + emit hovered(false, m_barset); + } +} + void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED(event) - emit clicked(m_barset, m_index); - emit clicked(m_index); + emit clicked(m_index, m_barset); } void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event) - emit hovered(m_barset, true); - emit hovered(true); + m_hovering = true; + emit hovered(true, m_barset); } void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event) - emit hovered(m_barset, false); - emit hovered(false); + m_hovering = false; + emit hovered(false, m_barset); } #include "moc_bar_p.cpp" diff --git a/src/barchart/bar_p.h b/src/barchart/bar_p.h index b3909b5..a2a62fd 100644 --- a/src/barchart/bar_p.h +++ b/src/barchart/bar_p.h @@ -43,6 +43,7 @@ class Bar : public QObject, public QGraphicsRectItem Q_OBJECT public: Bar(QBarSet *barset, int index, QGraphicsItem *parent = 0); + ~Bar(); public: void mousePressEvent(QGraphicsSceneMouseEvent *event); @@ -50,13 +51,12 @@ public: void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); Q_SIGNALS: - void clicked(QBarSet *barset, int index); - void hovered(QBarSet *barset, bool status); - void clicked(int index); - void hovered(bool status); + void clicked(int index, QBarSet *barset); + void hovered(bool status, QBarSet *barset); private: int m_index; + bool m_hovering; QBarSet *m_barset; }; diff --git a/src/barchart/barchartitem.cpp b/src/barchart/barchartitem.cpp index 3736ca9..5ec48fb 100644 --- a/src/barchart/barchartitem.cpp +++ b/src/barchart/barchartitem.cpp @@ -194,10 +194,10 @@ void BarChartItem::handleDataStructureChanged() // Bars Bar *bar = new Bar(set,c,this); m_bars.append(bar); - connect(bar, SIGNAL(clicked(QBarSet*,int)), m_series, SIGNAL(clicked(QBarSet*,int))); - connect(bar, SIGNAL(hovered(QBarSet*,bool)), m_series, SIGNAL(hovered(QBarSet*,bool))); - connect(bar, SIGNAL(clicked(int)), set, SIGNAL(clicked(int))); - connect(bar, SIGNAL(hovered(bool)), set, SIGNAL(hovered(bool))); + connect(bar, SIGNAL(clicked(int, QBarSet*)), m_series, SIGNAL(clicked(int, QBarSet*))); + connect(bar, SIGNAL(hovered(bool, QBarSet*)), m_series, SIGNAL(hovered(bool, QBarSet*))); + connect(bar, SIGNAL(clicked(int, QBarSet*)), set, SIGNAL(clicked(int))); + connect(bar, SIGNAL(hovered(bool, QBarSet*)), set, SIGNAL(hovered(bool))); m_layout.append(QRectF(0, 0, 0, 0)); // Labels diff --git a/src/barchart/qbarseries.cpp b/src/barchart/qbarseries.cpp index 847e076..970e96a 100644 --- a/src/barchart/qbarseries.cpp +++ b/src/barchart/qbarseries.cpp @@ -94,25 +94,25 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! - \fn void QBarSeries::clicked(QBarSet *barset, int index) + \fn void QBarSeries::clicked(int index, QBarSet *barset) The signal is emitted if the user clicks with a mouse on top of QBarSet \a barset. Clicked bar inside set is indexed by \a index */ /*! - \qmlsignal BarSeries::onClicked(BarSet barset, int index) + \qmlsignal BarSeries::onClicked(int index, BarSet barset) The signal is emitted if the user clicks with a mouse on top of BarSet. Clicked bar inside set is indexed by \a index */ /*! - \fn void QBarSeries::hovered(QBarSet* barset, bool status) + \fn void QBarSeries::hovered(bool status, QBarSet* barset) The signal is emitted if mouse is hovered on top of series. Parameter \a barset is the pointer of barset, where hover happened. Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. */ /*! - \qmlsignal BarSeries::onHovered(BarSet barset, bool status) + \qmlsignal BarSeries::onHovered(bool status, BarSet barset) The signal is emitted if mouse is hovered on top of series. Parameter \a barset is the pointer of barset, where hover happened. diff --git a/src/barchart/qbarseries.h b/src/barchart/qbarseries.h index c5ddb40..de7a367 100644 --- a/src/barchart/qbarseries.h +++ b/src/barchart/qbarseries.h @@ -61,8 +61,8 @@ protected: explicit QBarSeries(QBarSeriesPrivate &d,QObject *parent = 0); Q_SIGNALS: - void clicked(QBarSet *barset, int index); - void hovered(QBarSet* barset, bool status); + void clicked(int index, QBarSet *barset); + void hovered(bool status, QBarSet *barset); void countChanged(); void labelsVisibleChanged(); diff --git a/src/barchart/qbarseries_p.h b/src/barchart/qbarseries_p.h index c9a863b..21b9499 100644 --- a/src/barchart/qbarseries_p.h +++ b/src/barchart/qbarseries_p.h @@ -77,7 +77,7 @@ public: qreal maxX(); Q_SIGNALS: - void clicked(QBarSet *barset, int index); + void clicked(int index, QBarSet *barset); void updatedBars(); void restructuredBars(); void labelsVisibleChanged(bool visible); diff --git a/tests/auto/qbarseries/tst_qbarseries.cpp b/tests/auto/qbarseries/tst_qbarseries.cpp index 9e3bfea..737854a 100644 --- a/tests/auto/qbarseries/tst_qbarseries.cpp +++ b/tests/auto/qbarseries/tst_qbarseries.cpp @@ -326,7 +326,7 @@ void tst_QBarSeries::mouseclicked() *set2 << QPointF(0.3,10) << QPointF(1.3,10) << QPointF(2.3,10); series->append(set2); - QSignalSpy seriesSpy(series,SIGNAL(clicked(QBarSet*,int))); + QSignalSpy seriesSpy(series,SIGNAL(clicked(int,QBarSet*))); QSignalSpy setSpy1(set1, SIGNAL(clicked(int))); QSignalSpy setSpy2(set2, SIGNAL(clicked(int))); @@ -346,9 +346,9 @@ void tst_QBarSeries::mouseclicked() QCOMPARE(setSpy2.count(), 0); QList seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 0); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 0); QList setSpyArg = setSpy1.takeFirst(); QVERIFY(setSpyArg.at(0).type() == QVariant::Int); @@ -364,9 +364,9 @@ void tst_QBarSeries::mouseclicked() QCOMPARE(setSpy2.count(), 0); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 1); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 1); setSpyArg = setSpy1.takeFirst(); QVERIFY(setSpyArg.at(0).type() == QVariant::Int); @@ -382,9 +382,9 @@ void tst_QBarSeries::mouseclicked() QCOMPARE(setSpy2.count(), 0); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 2); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 2); setSpyArg = setSpy1.takeFirst(); QVERIFY(setSpyArg.at(0).type() == QVariant::Int); @@ -400,9 +400,9 @@ void tst_QBarSeries::mouseclicked() QCOMPARE(setSpy2.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 0); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 0); setSpyArg = setSpy2.takeFirst(); QVERIFY(setSpyArg.at(0).type() == QVariant::Int); @@ -418,9 +418,9 @@ void tst_QBarSeries::mouseclicked() QCOMPARE(setSpy2.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 1); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 1); setSpyArg = setSpy2.takeFirst(); QVERIFY(setSpyArg.at(0).type() == QVariant::Int); @@ -436,9 +436,9 @@ void tst_QBarSeries::mouseclicked() QCOMPARE(setSpy2.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 2); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 2); setSpyArg = setSpy2.takeFirst(); QVERIFY(setSpyArg.at(0).type() == QVariant::Int); @@ -462,7 +462,7 @@ void tst_QBarSeries::mousehovered() *set2 << QPointF(0.3,10) << QPointF(1.3,10) << QPointF(2.3,10); series->append(set2); - QSignalSpy seriesSpy(series,SIGNAL(hovered(QBarSet*,bool))); + QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*))); QSignalSpy setSpy1(set1, SIGNAL(hovered(bool))); QSignalSpy setSpy2(set2, SIGNAL(hovered(bool))); @@ -491,9 +491,9 @@ void tst_QBarSeries::mousehovered() TRY_COMPARE(setSpy2.count(), 0); QList seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == true); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == true); QList setSpyArg = setSpy1.takeFirst(); QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); @@ -508,9 +508,9 @@ void tst_QBarSeries::mousehovered() // should leave set1 seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == false); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == false); setSpyArg = setSpy1.takeFirst(); QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); @@ -518,9 +518,9 @@ void tst_QBarSeries::mousehovered() // should enter set2 seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == true); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == true); setSpyArg = setSpy2.takeFirst(); QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); @@ -535,9 +535,9 @@ void tst_QBarSeries::mousehovered() // should leave set2 seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == false); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == false); setSpyArg = setSpy2.takeFirst(); QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); diff --git a/tests/auto/qgroupedbarseries/tst_qgroupedbarseries.cpp b/tests/auto/qgroupedbarseries/tst_qgroupedbarseries.cpp index 3558e5f..33855ac 100644 --- a/tests/auto/qgroupedbarseries/tst_qgroupedbarseries.cpp +++ b/tests/auto/qgroupedbarseries/tst_qgroupedbarseries.cpp @@ -112,7 +112,7 @@ void tst_QGroupedBarSeries::mouseclicked() *set2 << 10 << 10 << 10; series->append(set2); - QSignalSpy seriesSpy(series,SIGNAL(clicked(QBarSet*,int))); + QSignalSpy seriesSpy(series,SIGNAL(clicked(int, QBarSet*))); QChartView view(new QChart()); view.resize(400,300); @@ -128,9 +128,9 @@ void tst_QGroupedBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); QList seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 0); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 0); //==================================================================================== // barset 1, category test2 @@ -140,9 +140,9 @@ void tst_QGroupedBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 1); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 1); //==================================================================================== // barset 1, category test3 @@ -152,9 +152,9 @@ void tst_QGroupedBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 2); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 2); //==================================================================================== // barset 2, category test1 @@ -164,9 +164,9 @@ void tst_QGroupedBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 0); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 0); //==================================================================================== // barset 2, category test2 @@ -176,9 +176,9 @@ void tst_QGroupedBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 1); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 1); //==================================================================================== // barset 2, category test3 @@ -188,9 +188,9 @@ void tst_QGroupedBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 2); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 2); } void tst_QGroupedBarSeries::mousehovered_data() @@ -210,7 +210,7 @@ void tst_QGroupedBarSeries::mousehovered() *set2 << 10 << 10 << 10; series->append(set2); - QSignalSpy seriesSpy(series,SIGNAL(hovered(QBarSet*,bool))); + QSignalSpy seriesSpy(series,SIGNAL(hovered(bool, QBarSet*))); QChartView view(new QChart()); view.resize(400,300); @@ -235,9 +235,9 @@ void tst_QGroupedBarSeries::mousehovered() TRY_COMPARE(seriesSpy.count(), 1); QList seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == true); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == true); //======================================================================= // move mouse from top of set1 to top of set2 @@ -247,15 +247,15 @@ void tst_QGroupedBarSeries::mousehovered() // should leave set1 seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == false); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == false); // should enter set2 seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == true); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == true); //======================================================================= // move mouse from top of set2 to background @@ -266,9 +266,9 @@ void tst_QGroupedBarSeries::mousehovered() // should leave set2 seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == false); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == false); } QTEST_MAIN(tst_QGroupedBarSeries) diff --git a/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp b/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp index b764107..55aef04 100644 --- a/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp +++ b/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp @@ -110,7 +110,7 @@ void tst_QPercentBarSeries::mouseclicked() *set2 << 10 << 10 << 10; series->append(set2); - QSignalSpy seriesSpy(series,SIGNAL(clicked(QBarSet*,int))); + QSignalSpy seriesSpy(series,SIGNAL(clicked(int, QBarSet*))); QChartView view(new QChart()); view.resize(400,300); @@ -126,9 +126,9 @@ void tst_QPercentBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); QList seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 0); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 0); //==================================================================================== // barset 1, category test2 @@ -138,9 +138,9 @@ void tst_QPercentBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 1); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 1); //==================================================================================== // barset 1, category test3 @@ -150,9 +150,9 @@ void tst_QPercentBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 2); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 2); //==================================================================================== // barset 2, category test1 @@ -162,9 +162,9 @@ void tst_QPercentBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 0); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 0); //==================================================================================== // barset 2, category test2 @@ -174,9 +174,9 @@ void tst_QPercentBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 1); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 1); //==================================================================================== // barset 2, category test3 @@ -186,9 +186,9 @@ void tst_QPercentBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 2); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 2); } void tst_QPercentBarSeries::mousehovered_data() @@ -208,7 +208,7 @@ void tst_QPercentBarSeries::mousehovered() *set2 << 10 << 10 << 10; series->append(set2); - QSignalSpy seriesSpy(series,SIGNAL(hovered(QBarSet*,bool))); + QSignalSpy seriesSpy(series,SIGNAL(hovered(bool, QBarSet*))); QChartView view(new QChart()); view.resize(400,300); @@ -231,9 +231,9 @@ void tst_QPercentBarSeries::mousehovered() TRY_COMPARE(seriesSpy.count(), 1); QList seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == true); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == true); //======================================================================= // move mouse from top of set1 to top of set2 @@ -242,15 +242,15 @@ void tst_QPercentBarSeries::mousehovered() // should leave set1 seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == false); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == false); // should enter set2 seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == true); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == true); //======================================================================= // move mouse from top of set2 to background @@ -259,9 +259,9 @@ void tst_QPercentBarSeries::mousehovered() // should leave set2 seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == false); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == false); } QTEST_MAIN(tst_QPercentBarSeries) diff --git a/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp b/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp index 91a63ba..8f64f00 100644 --- a/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp +++ b/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp @@ -110,7 +110,7 @@ void tst_QStackedBarSeries::mouseclicked() *set2 << 10 << 10 << 10; series->append(set2); - QSignalSpy seriesSpy(series,SIGNAL(clicked(QBarSet*,int))); + QSignalSpy seriesSpy(series,SIGNAL(clicked(int, QBarSet*))); QChartView view(new QChart()); view.resize(400,300); @@ -126,9 +126,9 @@ void tst_QStackedBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); QList seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 0); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 0); //==================================================================================== // barset 1, category test2 @@ -138,9 +138,9 @@ void tst_QStackedBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 1); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 1); //==================================================================================== // barset 1, category test3 @@ -150,9 +150,9 @@ void tst_QStackedBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 2); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 2); //==================================================================================== // barset 2, category test1 @@ -162,9 +162,9 @@ void tst_QStackedBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 0); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 0); //==================================================================================== // barset 2, category test2 @@ -174,9 +174,9 @@ void tst_QStackedBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 1); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 1); //==================================================================================== // barset 2, category test3 @@ -186,9 +186,9 @@ void tst_QStackedBarSeries::mouseclicked() QCOMPARE(seriesSpy.count(), 1); seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int); - QVERIFY(seriesSpyArg.at(1).toInt() == 2); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Int); + QVERIFY(seriesSpyArg.at(0).toInt() == 2); } void tst_QStackedBarSeries::mousehovered_data() @@ -208,7 +208,7 @@ void tst_QStackedBarSeries::mousehovered() *set2 << 10 << 10 << 10; series->append(set2); - QSignalSpy seriesSpy(series,SIGNAL(hovered(QBarSet*,bool))); + QSignalSpy seriesSpy(series,SIGNAL(hovered(bool, QBarSet*))); QChartView view(new QChart()); view.resize(400,300); @@ -231,9 +231,9 @@ void tst_QStackedBarSeries::mousehovered() TRY_COMPARE(seriesSpy.count(), 1); QList seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == true); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == true); //======================================================================= // move mouse from top of set1 to top of set2 @@ -242,15 +242,15 @@ void tst_QStackedBarSeries::mousehovered() // should leave set1 seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set1); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == false); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set1); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == false); // should enter set2 seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == true); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == true); //======================================================================= // move mouse from top of set2 to background @@ -259,9 +259,9 @@ void tst_QStackedBarSeries::mousehovered() // should leave set2 seriesSpyArg = seriesSpy.takeFirst(); - QCOMPARE(qvariant_cast(seriesSpyArg.at(0)), set2); - QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool); - QVERIFY(seriesSpyArg.at(1).toBool() == false); + QCOMPARE(qvariant_cast(seriesSpyArg.at(1)), set2); + QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); + QVERIFY(seriesSpyArg.at(0).toBool() == false); } QTEST_MAIN(tst_QStackedBarSeries)