diff --git a/example/barchart/main.cpp b/example/barchart/main.cpp index 474d570..cde40f5 100644 --- a/example/barchart/main.cpp +++ b/example/barchart/main.cpp @@ -47,9 +47,15 @@ int main(int argc, char *argv[]) //! [3] //! [4] - // Enable some features + // Enable tooltip series->setToolTipEnabled(); - series->setFloatingValuesEnabled(); + + // Connect clicked signal of set to toggle floating values of set. + // Note that we leave QBarset "Zak" unconnected here, so clicking on it doesn't toggle values. + QObject::connect(set0,SIGNAL(clicked(QString)),set0,SIGNAL(toggleFloatingValues())); + QObject::connect(set1,SIGNAL(clicked(QString)),set1,SIGNAL(toggleFloatingValues())); + QObject::connect(set2,SIGNAL(clicked(QString)),set2,SIGNAL(toggleFloatingValues())); + QObject::connect(set3,SIGNAL(clicked(QString)),set3,SIGNAL(toggleFloatingValues())); //! [4] //! [5] diff --git a/example/example.pro b/example/example.pro index 2a725df..2266f09 100644 --- a/example/example.pro +++ b/example/example.pro @@ -16,4 +16,5 @@ SUBDIRS += linechart \ chartview \ scatterinteractions \ splinechart \ - areachart + areachart \ + stackedbarchartdrilldown diff --git a/example/percentbarchart/main.cpp b/example/percentbarchart/main.cpp index 7545902..21a5f76 100644 --- a/example/percentbarchart/main.cpp +++ b/example/percentbarchart/main.cpp @@ -47,9 +47,15 @@ int main(int argc, char *argv[]) //! [3] //! [4] - // Enable features + // Enable tooltip series->setToolTipEnabled(); - series->setFloatingValuesEnabled(); + + // Connect clicked signal of set to toggle floating values of set. + // Note that we leave QBarset "Zak" unconnected here, so clicking on it doesn't toggle values. + QObject::connect(set0,SIGNAL(clicked(QString)),set0,SIGNAL(toggleFloatingValues())); + QObject::connect(set1,SIGNAL(clicked(QString)),set1,SIGNAL(toggleFloatingValues())); + QObject::connect(set2,SIGNAL(clicked(QString)),set2,SIGNAL(toggleFloatingValues())); + QObject::connect(set3,SIGNAL(clicked(QString)),set3,SIGNAL(toggleFloatingValues())); //! [4] //! [5] diff --git a/example/stackedbarchart/main.cpp b/example/stackedbarchart/main.cpp index 298fde2..bc10109 100644 --- a/example/stackedbarchart/main.cpp +++ b/example/stackedbarchart/main.cpp @@ -46,9 +46,15 @@ int main(int argc, char *argv[]) //! [3] //! [4] - // Enable features + // Enable tooltip series->setToolTipEnabled(); - series->setFloatingValuesEnabled(); + + // Connect clicked signal of set to toggle floating values of set. + // Note that we leave QBarset "Zak" unconnected here, so clicking on it doesn't toggle values. + QObject::connect(set0,SIGNAL(clicked(QString)),set0,SIGNAL(toggleFloatingValues())); + QObject::connect(set1,SIGNAL(clicked(QString)),set1,SIGNAL(toggleFloatingValues())); + QObject::connect(set2,SIGNAL(clicked(QString)),set2,SIGNAL(toggleFloatingValues())); + QObject::connect(set3,SIGNAL(clicked(QString)),set3,SIGNAL(toggleFloatingValues())); //! [4] //! [5] diff --git a/example/stackedbarchartdrilldown/chartwidget.cpp b/example/stackedbarchartdrilldown/chartwidget.cpp new file mode 100644 index 0000000..d6c7532 --- /dev/null +++ b/example/stackedbarchartdrilldown/chartwidget.cpp @@ -0,0 +1,6 @@ +#include "chartwidget.h" + +ChartWidget::ChartWidget(QWidget *parent) : + QChartView(parent) +{ +} diff --git a/example/stackedbarchartdrilldown/chartwidget.h b/example/stackedbarchartdrilldown/chartwidget.h new file mode 100644 index 0000000..b5625e3 --- /dev/null +++ b/example/stackedbarchartdrilldown/chartwidget.h @@ -0,0 +1,21 @@ +#ifndef CHARTWIDGET_H +#define CHARTWIDGET_H + +#include + +QTCOMMERCIALCHART_USE_NAMESPACE + + +class ChartWidget : public QChartView +{ + Q_OBJECT +public: + explicit ChartWidget(QWidget *parent = 0); + +signals: + +public slots: + +}; + +#endif // CHARTWIDGET_H diff --git a/example/stackedbarchartdrilldown/main.cpp b/example/stackedbarchartdrilldown/main.cpp new file mode 100644 index 0000000..2b2247b --- /dev/null +++ b/example/stackedbarchartdrilldown/main.cpp @@ -0,0 +1,83 @@ +#include +#include +#include +#include +#include +#include +#include + +QTCOMMERCIALCHART_USE_NAMESPACE + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QMainWindow window; + + // TODO: +/* + //! [1] + // Define categories + QStringList categories; + categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; + //! [1] + + //! [2] + // Create some test sets for chat + QBarSet *set0 = new QBarSet("Bub"); + QBarSet *set1 = new QBarSet("Bob"); + QBarSet *set2 = new QBarSet("Guybrush"); + QBarSet *set3 = new QBarSet("Larry"); + QBarSet *set4 = new QBarSet("Zak"); + + *set0 << 1 << 2 << 3 << 4 << 5 << 6; + *set1 << 5 << 0 << 0 << 4 << 0 << 7; + *set2 << 3 << 5 << 8 << 13 << 8 << 5; + *set3 << 5 << 6 << 7 << 3 << 4 << 5; + *set4 << 9 << 7 << 5 << 3 << 1 << 2; + //! [2] + + //! [3] + // Create series and add sets to it + QStackedBarSeries* series = new QStackedBarSeries(categories); + + series->addBarSet(set0); + series->addBarSet(set1); + series->addBarSet(set2); + series->addBarSet(set3); + series->addBarSet(set4); + //! [3] + + //! [4] + // Enable tooltip + series->setToolTipEnabled(); + + // Connect clicked signal of set to toggle floating values of set. + // Note that we leave QBarset "Zak" unconnected here, so clicking on it doesn't toggle values. + QObject::connect(set0,SIGNAL(clicked(QBarSet*,QString)),set0,SIGNAL(toggleFloatingValues())); + QObject::connect(set1,SIGNAL(clicked(QBarSet*,QString)),set1,SIGNAL(toggleFloatingValues())); + QObject::connect(set2,SIGNAL(clicked(QBarSet*,QString)),set2,SIGNAL(toggleFloatingValues())); + QObject::connect(set3,SIGNAL(clicked(QBarSet*,QString)),set3,SIGNAL(toggleFloatingValues())); + //! [4] + + //! [5] + // Create view for chart and add series to it. Apply theme. + + QChartView* chartView = new QChartView(&window); + chartView->addSeries(series); + chartView->setChartTitle("simple stacked barchart"); + chartView->setChartTheme(QChart::ChartThemeIcy); + //! [5] + + //! [6] + chartView->axisX()->setAxisVisible(false); + chartView->axisX()->setGridVisible(false); + chartView->axisX()->setLabelsVisible(false); + //! [6] + + window.setCentralWidget(chartView); + window.resize(400, 300); + window.show(); +*/ + return a.exec(); +} + diff --git a/example/stackedbarchartdrilldown/stackedbarchartdrilldown.pro b/example/stackedbarchartdrilldown/stackedbarchartdrilldown.pro new file mode 100644 index 0000000..67e7475 --- /dev/null +++ b/example/stackedbarchartdrilldown/stackedbarchartdrilldown.pro @@ -0,0 +1,9 @@ +!include( ../example.pri ) { + error( "Couldn't find the example.pri file!" ) +} +TARGET = stackedbarchartdrilldown +SOURCES += main.cpp \ + chartwidget.cpp +HEADERS += \ + chartwidget.h + diff --git a/src/barchart/bar.cpp b/src/barchart/bar.cpp index 13fec18..ebc873e 100644 --- a/src/barchart/bar.cpp +++ b/src/barchart/bar.cpp @@ -5,8 +5,9 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -Bar::Bar(QGraphicsItem *parent) +Bar::Bar(QString category, QGraphicsItem *parent) : QGraphicsObject(parent) + ,mCategory(category) { setAcceptedMouseButtons(Qt::LeftButton|Qt::RightButton); setAcceptHoverEvents(true); @@ -67,9 +68,9 @@ QRectF Bar::boundingRect() const void Bar::mousePressEvent(QGraphicsSceneMouseEvent* event) { if (event->button() == Qt::LeftButton) { - emit clicked(); + emit clicked(mCategory); } else if (event->button() == Qt::RightButton) { - emit rightClicked(); + emit rightClicked(mCategory); } } diff --git a/src/barchart/bar_p.h b/src/barchart/bar_p.h index 704f44b..827dde4 100644 --- a/src/barchart/bar_p.h +++ b/src/barchart/bar_p.h @@ -13,7 +13,7 @@ class Bar : public QGraphicsObject { Q_OBJECT public: - Bar(QGraphicsItem *parent=0); + Bar(QString category, QGraphicsItem *parent=0); public: // from ChartItem void setSize(const QSizeF &size); @@ -33,8 +33,8 @@ public: void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); Q_SIGNALS: - void clicked(); - void rightClicked(); + void clicked(QString category); + void rightClicked(QString category); void hoverEntered(QPoint pos); void hoverLeaved(); @@ -48,6 +48,7 @@ private: QBrush mBrush; QPen mPen; + QString mCategory; }; QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/barcategory.cpp b/src/barchart/barcategory.cpp deleted file mode 100644 index f405dd9..0000000 --- a/src/barchart/barcategory.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "barcategory_p.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE -BarCategory::BarCategory(QString name, QObject *parent) : - QObject(parent) - ,mName(name) -{ -} - -void BarCategory::barRightClickEvent() -{ - // TODO: - emit rightClicked(mName); -} - -#include "moc_barcategory_p.cpp" -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/barcategory_p.h b/src/barchart/barcategory_p.h deleted file mode 100644 index 96df531..0000000 --- a/src/barchart/barcategory_p.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef BARCATEGORY_P_H -#define BARCATEGORY_P_H - -#include -#include - -QTCOMMERCIALCHART_BEGIN_NAMESPACE -// Event handler for bar category -class BarCategory : public QObject -{ - Q_OBJECT -public: - explicit BarCategory(QString name, QObject *parent = 0); - -signals: - void rightClicked(QString name); // "We want something to happen that involves this category" - -public slots: - void barRightClickEvent(); - -private: - QString mName; -}; - -QTCOMMERCIALCHART_END_NAMESPACE -#endif // BARCATEGORY_P_H diff --git a/src/barchart/barchart.pri b/src/barchart/barchart.pri index 926999c..2c126d8 100644 --- a/src/barchart/barchart.pri +++ b/src/barchart/barchart.pri @@ -14,8 +14,7 @@ SOURCES += \ $$PWD/qstackedbarseries.cpp \ $$PWD/separator.cpp \ $$PWD/stackedbarpresenter.cpp \ - $$PWD/barvalue.cpp \ - $$PWD/barcategory.cpp + $$PWD/barvalue.cpp PRIVATE_HEADERS += \ $$PWD/bar_p.h \ @@ -26,8 +25,7 @@ PRIVATE_HEADERS += \ $$PWD/percentbarpresenter_p.h \ $$PWD/separator_p.h \ $$PWD/stackedbarpresenter_p.h \ - $$PWD/barvalue_p.h \ - $$PWD/barcategory_p.h + $$PWD/barvalue_p.h PUBLIC_HEADERS += \ $$PWD/qbarseries.h \ diff --git a/src/barchart/barchartmodel.cpp b/src/barchart/barchartmodel.cpp index 450408f..0bb3e5b 100644 --- a/src/barchart/barchartmodel.cpp +++ b/src/barchart/barchartmodel.cpp @@ -2,7 +2,6 @@ #include #include #include "barchartmodel_p.h" -#include "barcategory_p.h" #include "qbarset.h" QTCOMMERCIALCHART_BEGIN_NAMESPACE @@ -11,10 +10,6 @@ BarChartModel::BarChartModel(QStringList categories, QObject *parent) : QObject(parent) ,mCategory(categories) { - for (int i=0; i mDataModel; QStringList mCategory; - QList mCategoryObjects; int mCurrentSet; diff --git a/src/barchart/barpresenterbase.cpp b/src/barchart/barpresenterbase.cpp index c3974cb..2e4acc6 100644 --- a/src/barchart/barpresenterbase.cpp +++ b/src/barchart/barpresenterbase.cpp @@ -3,7 +3,6 @@ #include "barvalue_p.h" #include "barlabel_p.h" #include "separator_p.h" -#include "barcategory_p.h" #include "qbarset.h" #include "qbarseries.h" #include @@ -20,7 +19,7 @@ BarPresenterBase::BarPresenterBase(QBarSeries *series, QGraphicsItem *parent) ,mSeries(series) { connect(series,SIGNAL(showToolTip(QPoint,QString)),this,SLOT(showToolTip(QPoint,QString))); - connect(series,SIGNAL(separatorsEnabled(bool)),this,SLOT(enableSeparators(bool))); +// connect(series,SIGNAL(separatorsEnabled(bool)),this,SLOT(enableSeparators(bool))); dataChanged(); } @@ -70,14 +69,14 @@ void BarPresenterBase::dataChanged() // Create new graphic items for bars for (int c=0; ccategoryCount(); c++) { - BarCategory *category = mSeries->categoryObject(c); + QString category = mSeries->categoryName(c); for (int s=0; sbarsetCount(); s++) { QBarSet *set = mSeries->barsetAt(s); - Bar *bar = new Bar(this); + Bar *bar = new Bar(category,this); childItems().append(bar); mBars.append(bar); - connect(bar,SIGNAL(clicked()),set,SLOT(barClickedEvent())); - connect(bar,SIGNAL(rightClicked()),category,SLOT(barRightClickEvent())); + connect(bar,SIGNAL(clicked(QString)),set,SIGNAL(clicked(QString))); + connect(bar,SIGNAL(rightClicked(QString)),set,SIGNAL(rightClicked(QString))); connect(bar,SIGNAL(hoverEntered(QPoint)),set,SLOT(barHoverEnterEvent(QPoint))); connect(bar,SIGNAL(hoverLeaved()),set,SLOT(barHoverLeaveEvent())); } diff --git a/src/barchart/barvalue.cpp b/src/barchart/barvalue.cpp index 9b43e41..7715da2 100644 --- a/src/barchart/barvalue.cpp +++ b/src/barchart/barvalue.cpp @@ -43,13 +43,6 @@ void BarValue::setPos(qreal x, qreal y) mYpos = y; } -/* -bool BarValue::belongsToSet(QBarSet *set) -{ - return (&mBarSet == set); -} -*/ - void BarValue::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { if (isVisible()) { diff --git a/src/barchart/barvalue_p.h b/src/barchart/barvalue_p.h index c5ec4a5..471f999 100644 --- a/src/barchart/barvalue_p.h +++ b/src/barchart/barvalue_p.h @@ -10,7 +10,6 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE class QBarSet; // Visual class for floating bar values -// TODO: fonts, colors etc. // By default these are not visible. class BarValue : public QGraphicsObject { @@ -27,9 +26,6 @@ public: void resize(qreal w, qreal h); void setPos(qreal x, qreal y); - // Propably not needed. -// bool belongsToSet(QBarSet *set); - // From QGraphicsItem void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); QRectF boundingRect() const; diff --git a/src/barchart/qbarseries.cpp b/src/barchart/qbarseries.cpp index b67549f..b98c215 100644 --- a/src/barchart/qbarseries.cpp +++ b/src/barchart/qbarseries.cpp @@ -2,7 +2,6 @@ #include "qbarseries.h" #include "qbarset.h" #include "barchartmodel_p.h" -#include "barcategory_p.h" QTCOMMERCIALCHART_BEGIN_NAMESPACE @@ -24,22 +23,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE \brief Returns type of series. \sa QSeries, QSeriesType */ -/*! - \fn void QBarSeries::changed(int index) - \brief \internal \a index -*/ -/*! - \fn void QBarSeries::floatingValuesEnabled(bool enabled) - \brief \internal \a enabled -*/ -/*! - \fn void QBarSeries::toolTipEnabled(bool enabled) - \brief \internal \a enabled -*/ -/*! - \fn void QBarSeries::separatorsEnabled(bool enabled) - \brief \internal \a enabled -*/ + /*! \fn void QBarSeries::showToolTip(QPoint pos, QString tip) \brief \internal \a pos \a tip @@ -53,25 +37,29 @@ QBarSeries::QBarSeries(QStringList categories, QObject *parent) : QSeries(parent) ,mModel(new BarChartModel(categories, this)) { - for (int i=0; icategoryCount(); i++) { - BarCategory *categoryObject = mModel->categoryObject(i); - connect(categoryObject, SIGNAL(rightClicked(QString)), this, SIGNAL(categoryRightClicked(QString))); - } } /*! - Adds a set of bars to series. Takes ownership of \a set + Adds a set of bars to series. Takes ownership of \a set. + Connects the clicked(QString) and rightClicked(QString) signals + of \a set to this series */ void QBarSeries::addBarSet(QBarSet *set) { mModel->addBarSet(set); + connect(set,SIGNAL(clicked(QString)),this,SLOT(barsetClicked(QString))); + connect(set,SIGNAL(rightClicked(QString)),this,SLOT(barsetRightClicked(QString))); } /*! Removes a set of bars from series. Releases ownership of \a set. Doesnt delete \a set. + Disconnects the clicked(QString) and rightClicked(QString) signals + of \a set from this series */ void QBarSeries::removeBarSet(QBarSet *set) { + disconnect(set,SIGNAL(clicked(QString)),this,SLOT(barsetClicked(QString))); + disconnect(set,SIGNAL(rightClicked(QString)),this,SLOT(barsetRightClicked(QString))); mModel->removeBarSet(set); } @@ -124,26 +112,6 @@ QString QBarSeries::categoryName(int category) } /*! - Enables or disables floating values depending on parameter \a enabled. - Floating values are bar values, that are displayed on top of each bar. - Calling without parameter \a enabled, enables the floating values -*/ -void QBarSeries::setFloatingValuesEnabled(bool enabled) -{ - if (enabled) { - for (int i=0; ibarsetCount(); i++) { - QBarSet *set = mModel->setAt(i); - connect(set,SIGNAL(clicked()),set,SIGNAL(toggleFloatingValues())); - } - } else { - for (int i=0; ibarsetCount(); i++) { - QBarSet *set = mModel->setAt(i); - disconnect(set,SIGNAL(clicked()),set,SIGNAL(toggleFloatingValues())); - } - } -} - -/*! Enables or disables tooltip depending on parameter \a enabled. Tooltip shows the name of set, when mouse is hovering on top of bar. Calling without parameter \a enabled, enables the tooltip @@ -170,9 +138,28 @@ void QBarSeries::setToolTipEnabled(bool enabled) */ void QBarSeries::setSeparatorsEnabled(bool enabled) { - emit separatorsEnabled(enabled); + // TODO: toggle +// emit separatorsEnabled(enabled); } + +/*! + \internal \a category +*/ +void QBarSeries::barsetClicked(QString category) +{ + emit clicked(qobject_cast(sender()), category); +} + +/*! + \internal \a category +*/ +void QBarSeries::barsetRightClicked(QString category) +{ + emit rightClicked(qobject_cast(sender()), category); +} + + /*! \internal */ @@ -229,12 +216,6 @@ BarChartModel& QBarSeries::model() return *mModel; } -BarCategory* QBarSeries::categoryObject(int category) -{ - return mModel->categoryObject(category); -} - - #include "moc_qbarseries.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/qbarseries.h b/src/barchart/qbarseries.h index 5e68d4c..930ba4e 100644 --- a/src/barchart/qbarseries.h +++ b/src/barchart/qbarseries.h @@ -39,26 +39,27 @@ public: qreal categorySum(int category); qreal maxCategorySum(); BarChartModel& model(); - BarCategory* categoryObject(int category); // <--- TO PIMPL signals: - void changed(int index); - void categoryRightClicked(QString category); + //void changed(int index); + void clicked(QBarSet* barset, QString category); // Up to user of api, what to do with these signals + void rightClicked(QBarSet* barset, QString category); // TODO: internal signals, these to private implementation. // TODO: TO PIMPL ---> - void floatingValuesEnabled(bool enabled); - void toolTipEnabled(bool enabled); - void separatorsEnabled(bool enabled); void showToolTip(QPoint pos, QString tip); // <--- TO PIMPL public Q_SLOTS: - void setFloatingValuesEnabled(bool enabled=true); // enables floating values on top of bars void setToolTipEnabled(bool enabled=true); // enables tooltips void setSeparatorsEnabled(bool enabled=true); // enables separators between categories + // TODO: TO PIMPL ---> + void barsetClicked(QString category); + void barsetRightClicked(QString category); + // <--- TO PIMPL + protected: BarChartModel* mModel; }; diff --git a/src/barchart/qbarset.cpp b/src/barchart/qbarset.cpp index 4d15a4f..14fb989 100644 --- a/src/barchart/qbarset.cpp +++ b/src/barchart/qbarset.cpp @@ -19,21 +19,32 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! - \fn void QBarSet::clicked() + \fn void QBarSet::clicked(QString category) \brief signals that set has been clicked + Parameter \a category describes on which category was clicked */ + +/*! + \fn void QBarSet::rightClicked(QString category) + \brief signals that set has been clicked with right mouse button + Parameter \a category describes on which category was clicked +*/ + /*! \fn void QBarSet::hoverEnter(QPoint pos) \brief signals that mouse has entered over the set at position \a pos. */ + /*! \fn void QBarSet::hoverLeave() \brief signals that mouse has left from the set. */ + /*! \fn void QBarSet::toggleFloatingValues() \brief \internal */ + /*! \fn void QBarSet::showToolTip(QPoint pos, QString tip) \brief \internal \a pos \a tip @@ -130,16 +141,20 @@ QBrush QBarSet::brush() return mBrush; } -/*! - \internal -*/ -void QBarSet::barClickedEvent() +/* +void QBarSet::barClickedEvent(QString category) { // Some bar of this set has been clicked // TODO: What happens then? - emit clicked(); // Notify that set has been clicked + emit clicked(category); // Notify that set has been clicked } +void QBarSet::barRightClickedEvent(QString category) +{ + emit rightClicked(category); +} +*/ + /*! \internal \a pos */ diff --git a/src/barchart/qbarset.h b/src/barchart/qbarset.h index a3d3e6b..12b116e 100644 --- a/src/barchart/qbarset.h +++ b/src/barchart/qbarset.h @@ -28,20 +28,22 @@ public: QBrush brush(); Q_SIGNALS: - void clicked(); // Clicked and hover signals exposed to user - void hoverEnter(QPoint pos); - void hoverLeave(); + void clicked(QString category); // Clicked and hover signals exposed to user + void rightClicked(QString category); + void toggleFloatingValues(); // TODO: Expose this to user or not? // TODO: TO PIMPL ---> - void toggleFloatingValues(); + void hoverEnter(QPoint pos); + void hoverLeave(); void showToolTip(QPoint pos, QString tip); // Private signal // <--- TO PIMPL public Q_SLOTS: // These are for internal communication // TODO: TO PIMPL ---> - void barClickedEvent(); +// void barClickedEvent(QString category); +// void barRightClickedEvent(QString category); void barHoverEnterEvent(QPoint pos); void barHoverLeaveEvent(); // <--- TO PIMPL diff --git a/src/chartpresenter.cpp b/src/chartpresenter.cpp index a4d76e2..903c44f 100644 --- a/src/chartpresenter.cpp +++ b/src/chartpresenter.cpp @@ -148,7 +148,7 @@ void ChartPresenter::handleSeriesAdded(QSeries* series) BarPresenter* item = new BarPresenter(barSeries,m_chart); m_chartTheme->decorate(item,barSeries,m_chartItems.count()); QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); - QObject::connect(barSeries,SIGNAL(changed(int)),item,SLOT(handleModelChanged(int))); + // QObject::connect(barSeries,SIGNAL(changed(int)),item,SLOT(handleModelChanged(int))); m_chartItems.insert(series,item); // m_axisXItem->setVisible(false); if(m_rect.isValid()) item->handleGeometryChanged(m_rect); @@ -161,7 +161,7 @@ void ChartPresenter::handleSeriesAdded(QSeries* series) StackedBarPresenter* item = new StackedBarPresenter(stackedBarSeries,m_chart); m_chartTheme->decorate(item,stackedBarSeries,m_chartItems.count()); QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); - QObject::connect(stackedBarSeries,SIGNAL(changed(int)),item,SLOT(handleModelChanged(int))); + // QObject::connect(stackedBarSeries,SIGNAL(changed(int)),item,SLOT(handleModelChanged(int))); m_chartItems.insert(series,item); if(m_rect.isValid()) item->handleGeometryChanged(m_rect); break; @@ -173,7 +173,7 @@ void ChartPresenter::handleSeriesAdded(QSeries* series) PercentBarPresenter* item = new PercentBarPresenter(percentBarSeries,m_chart); m_chartTheme->decorate(item,percentBarSeries ,m_chartItems.count()); QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); - QObject::connect(percentBarSeries,SIGNAL(changed(int)),item,SLOT(handleModelChanged(int))); + // QObject::connect(percentBarSeries,SIGNAL(changed(int)),item,SLOT(handleModelChanged(int))); m_chartItems.insert(series,item); if(m_rect.isValid()) item->handleGeometryChanged(m_rect); break; @@ -214,6 +214,7 @@ void ChartPresenter::handleSeriesAdded(QSeries* series) pie->handleGeometryChanged(m_rect); break; } + case QSeries::SeriesTypeSpline: { QSplineSeries* splineSeries = qobject_cast(series); SplinePresenter* splinePresenter = new SplinePresenter(splineSeries, m_chart); @@ -226,7 +227,6 @@ void ChartPresenter::handleSeriesAdded(QSeries* series) qDebug()<< "Series type" << series->type() << "not implemented."; break; } - } } diff --git a/test/chartwidgettest/mainwidget.cpp b/test/chartwidgettest/mainwidget.cpp index 42cb270..0e573e9 100644 --- a/test/chartwidgettest/mainwidget.cpp +++ b/test/chartwidgettest/mainwidget.cpp @@ -290,7 +290,8 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS } series->addBarSet(set); } - series->setFloatingValuesEnabled(true); + // TODO: new implementation of setFloatingValuesEnabled with signals + //series->setFloatingValuesEnabled(true); series->setToolTipEnabled(true); series->setSeparatorsEnabled(false); m_chartView->addSeries(series);