##// END OF EJS Templates
Better way to enable features to user. Do less, but expose signals to user and allow user to descide what to do.
sauimone -
r425:85842e6c8dba
parent child
Show More
@@ -0,0 +1,6
1 #include "chartwidget.h"
2
3 ChartWidget::ChartWidget(QWidget *parent) :
4 QChartView(parent)
5 {
6 }
@@ -0,0 +1,21
1 #ifndef CHARTWIDGET_H
2 #define CHARTWIDGET_H
3
4 #include <qchartview.h>
5
6 QTCOMMERCIALCHART_USE_NAMESPACE
7
8
9 class ChartWidget : public QChartView
10 {
11 Q_OBJECT
12 public:
13 explicit ChartWidget(QWidget *parent = 0);
14
15 signals:
16
17 public slots:
18
19 };
20
21 #endif // CHARTWIDGET_H
@@ -0,0 +1,83
1 #include <QApplication>
2 #include <QMainWindow>
3 #include <qchartview.h>
4 #include <qstackedbarseries.h>
5 #include <qbarset.h>
6 #include <qchartaxis.h>
7 #include <QStringList>
8
9 QTCOMMERCIALCHART_USE_NAMESPACE
10
11 int main(int argc, char *argv[])
12 {
13 QApplication a(argc, argv);
14 QMainWindow window;
15
16 // TODO:
17 /*
18 //! [1]
19 // Define categories
20 QStringList categories;
21 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
22 //! [1]
23
24 //! [2]
25 // Create some test sets for chat
26 QBarSet *set0 = new QBarSet("Bub");
27 QBarSet *set1 = new QBarSet("Bob");
28 QBarSet *set2 = new QBarSet("Guybrush");
29 QBarSet *set3 = new QBarSet("Larry");
30 QBarSet *set4 = new QBarSet("Zak");
31
32 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
33 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
34 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
35 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
36 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
37 //! [2]
38
39 //! [3]
40 // Create series and add sets to it
41 QStackedBarSeries* series = new QStackedBarSeries(categories);
42
43 series->addBarSet(set0);
44 series->addBarSet(set1);
45 series->addBarSet(set2);
46 series->addBarSet(set3);
47 series->addBarSet(set4);
48 //! [3]
49
50 //! [4]
51 // Enable tooltip
52 series->setToolTipEnabled();
53
54 // Connect clicked signal of set to toggle floating values of set.
55 // Note that we leave QBarset "Zak" unconnected here, so clicking on it doesn't toggle values.
56 QObject::connect(set0,SIGNAL(clicked(QBarSet*,QString)),set0,SIGNAL(toggleFloatingValues()));
57 QObject::connect(set1,SIGNAL(clicked(QBarSet*,QString)),set1,SIGNAL(toggleFloatingValues()));
58 QObject::connect(set2,SIGNAL(clicked(QBarSet*,QString)),set2,SIGNAL(toggleFloatingValues()));
59 QObject::connect(set3,SIGNAL(clicked(QBarSet*,QString)),set3,SIGNAL(toggleFloatingValues()));
60 //! [4]
61
62 //! [5]
63 // Create view for chart and add series to it. Apply theme.
64
65 QChartView* chartView = new QChartView(&window);
66 chartView->addSeries(series);
67 chartView->setChartTitle("simple stacked barchart");
68 chartView->setChartTheme(QChart::ChartThemeIcy);
69 //! [5]
70
71 //! [6]
72 chartView->axisX()->setAxisVisible(false);
73 chartView->axisX()->setGridVisible(false);
74 chartView->axisX()->setLabelsVisible(false);
75 //! [6]
76
77 window.setCentralWidget(chartView);
78 window.resize(400, 300);
79 window.show();
80 */
81 return a.exec();
82 }
83
@@ -0,0 +1,9
1 !include( ../example.pri ) {
2 error( "Couldn't find the example.pri file!" )
3 }
4 TARGET = stackedbarchartdrilldown
5 SOURCES += main.cpp \
6 chartwidget.cpp
7 HEADERS += \
8 chartwidget.h
9
@@ -47,9 +47,15 int main(int argc, char *argv[])
47 47 //! [3]
48 48
49 49 //! [4]
50 // Enable some features
50 // Enable tooltip
51 51 series->setToolTipEnabled();
52 series->setFloatingValuesEnabled();
52
53 // Connect clicked signal of set to toggle floating values of set.
54 // Note that we leave QBarset "Zak" unconnected here, so clicking on it doesn't toggle values.
55 QObject::connect(set0,SIGNAL(clicked(QString)),set0,SIGNAL(toggleFloatingValues()));
56 QObject::connect(set1,SIGNAL(clicked(QString)),set1,SIGNAL(toggleFloatingValues()));
57 QObject::connect(set2,SIGNAL(clicked(QString)),set2,SIGNAL(toggleFloatingValues()));
58 QObject::connect(set3,SIGNAL(clicked(QString)),set3,SIGNAL(toggleFloatingValues()));
53 59 //! [4]
54 60
55 61 //! [5]
@@ -15,4 +15,5 SUBDIRS += linechart \
15 15 presenterchart \
16 16 chartview \
17 17 scatterinteractions \
18 areachart
18 areachart \
19 stackedbarchartdrilldown
@@ -47,9 +47,15 int main(int argc, char *argv[])
47 47 //! [3]
48 48
49 49 //! [4]
50 // Enable features
50 // Enable tooltip
51 51 series->setToolTipEnabled();
52 series->setFloatingValuesEnabled();
52
53 // Connect clicked signal of set to toggle floating values of set.
54 // Note that we leave QBarset "Zak" unconnected here, so clicking on it doesn't toggle values.
55 QObject::connect(set0,SIGNAL(clicked(QString)),set0,SIGNAL(toggleFloatingValues()));
56 QObject::connect(set1,SIGNAL(clicked(QString)),set1,SIGNAL(toggleFloatingValues()));
57 QObject::connect(set2,SIGNAL(clicked(QString)),set2,SIGNAL(toggleFloatingValues()));
58 QObject::connect(set3,SIGNAL(clicked(QString)),set3,SIGNAL(toggleFloatingValues()));
53 59 //! [4]
54 60
55 61 //! [5]
@@ -46,9 +46,15 int main(int argc, char *argv[])
46 46 //! [3]
47 47
48 48 //! [4]
49 // Enable features
49 // Enable tooltip
50 50 series->setToolTipEnabled();
51 series->setFloatingValuesEnabled();
51
52 // Connect clicked signal of set to toggle floating values of set.
53 // Note that we leave QBarset "Zak" unconnected here, so clicking on it doesn't toggle values.
54 QObject::connect(set0,SIGNAL(clicked(QString)),set0,SIGNAL(toggleFloatingValues()));
55 QObject::connect(set1,SIGNAL(clicked(QString)),set1,SIGNAL(toggleFloatingValues()));
56 QObject::connect(set2,SIGNAL(clicked(QString)),set2,SIGNAL(toggleFloatingValues()));
57 QObject::connect(set3,SIGNAL(clicked(QString)),set3,SIGNAL(toggleFloatingValues()));
52 58 //! [4]
53 59
54 60 //! [5]
@@ -5,8 +5,9
5 5
6 6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
7 7
8 Bar::Bar(QGraphicsItem *parent)
8 Bar::Bar(QString category, QGraphicsItem *parent)
9 9 : QGraphicsObject(parent)
10 ,mCategory(category)
10 11 {
11 12 setAcceptedMouseButtons(Qt::LeftButton|Qt::RightButton);
12 13 setAcceptHoverEvents(true);
@@ -67,9 +68,9 QRectF Bar::boundingRect() const
67 68 void Bar::mousePressEvent(QGraphicsSceneMouseEvent* event)
68 69 {
69 70 if (event->button() == Qt::LeftButton) {
70 emit clicked();
71 emit clicked(mCategory);
71 72 } else if (event->button() == Qt::RightButton) {
72 emit rightClicked();
73 emit rightClicked(mCategory);
73 74 }
74 75 }
75 76
@@ -13,7 +13,7 class Bar : public QGraphicsObject
13 13 {
14 14 Q_OBJECT
15 15 public:
16 Bar(QGraphicsItem *parent=0);
16 Bar(QString category, QGraphicsItem *parent=0);
17 17
18 18 public: // from ChartItem
19 19 void setSize(const QSizeF &size);
@@ -33,8 +33,8 public:
33 33 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
34 34
35 35 Q_SIGNALS:
36 void clicked();
37 void rightClicked();
36 void clicked(QString category);
37 void rightClicked(QString category);
38 38 void hoverEntered(QPoint pos);
39 39 void hoverLeaved();
40 40
@@ -48,6 +48,7 private:
48 48 QBrush mBrush;
49 49 QPen mPen;
50 50
51 QString mCategory;
51 52 };
52 53
53 54 QTCOMMERCIALCHART_END_NAMESPACE
@@ -14,8 +14,7 SOURCES += \
14 14 $$PWD/qstackedbarseries.cpp \
15 15 $$PWD/separator.cpp \
16 16 $$PWD/stackedbarpresenter.cpp \
17 $$PWD/barvalue.cpp \
18 $$PWD/barcategory.cpp
17 $$PWD/barvalue.cpp
19 18
20 19 PRIVATE_HEADERS += \
21 20 $$PWD/bar_p.h \
@@ -26,8 +25,7 PRIVATE_HEADERS += \
26 25 $$PWD/percentbarpresenter_p.h \
27 26 $$PWD/separator_p.h \
28 27 $$PWD/stackedbarpresenter_p.h \
29 $$PWD/barvalue_p.h \
30 $$PWD/barcategory_p.h
28 $$PWD/barvalue_p.h
31 29
32 30 PUBLIC_HEADERS += \
33 31 $$PWD/qbarseries.h \
@@ -2,7 +2,6
2 2 #include <QVector>
3 3 #include <QDebug>
4 4 #include "barchartmodel_p.h"
5 #include "barcategory_p.h"
6 5 #include "qbarset.h"
7 6
8 7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
@@ -11,10 +10,6 BarChartModel::BarChartModel(QStringList categories, QObject *parent) :
11 10 QObject(parent)
12 11 ,mCategory(categories)
13 12 {
14 for (int i=0; i<mCategory.count(); i++) {
15 BarCategory* cat = new BarCategory(mCategory.at(i), this);
16 mCategoryObjects.append(cat);
17 }
18 13 }
19 14
20 15 QStringList BarChartModel::category()
@@ -172,11 +167,6 QString BarChartModel::categoryName(int category)
172 167 return mCategory.at(category);
173 168 }
174 169
175 BarCategory* BarChartModel::categoryObject(int category)
176 {
177 return mCategoryObjects.at(category);
178 }
179
180 170 #include "moc_barchartmodel_p.cpp"
181 171
182 172 QTCOMMERCIALCHART_END_NAMESPACE
@@ -12,7 +12,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
12 12 // TODO: Implement as QAbstractItemModel?
13 13
14 14 class QBarSet;
15 class BarCategory;
16 15
17 16 class BarChartModel : public QObject //, public QAbstractItemModel
18 17 {
@@ -40,7 +39,6 public:
40 39 qreal maxCategorySum(); // returns maximum sum of sets in all categories.
41 40
42 41 QString categoryName(int category);
43 BarCategory* categoryObject(int category);
44 42
45 43 signals:
46 44 void modelUpdated();
@@ -51,7 +49,6 private:
51 49
52 50 QList<QBarSet*> mDataModel;
53 51 QStringList mCategory;
54 QList<BarCategory*> mCategoryObjects;
55 52
56 53 int mCurrentSet;
57 54
@@ -3,7 +3,6
3 3 #include "barvalue_p.h"
4 4 #include "barlabel_p.h"
5 5 #include "separator_p.h"
6 #include "barcategory_p.h"
7 6 #include "qbarset.h"
8 7 #include "qbarseries.h"
9 8 #include <QDebug>
@@ -20,7 +19,7 BarPresenterBase::BarPresenterBase(QBarSeries *series, QGraphicsItem *parent)
20 19 ,mSeries(series)
21 20 {
22 21 connect(series,SIGNAL(showToolTip(QPoint,QString)),this,SLOT(showToolTip(QPoint,QString)));
23 connect(series,SIGNAL(separatorsEnabled(bool)),this,SLOT(enableSeparators(bool)));
22 // connect(series,SIGNAL(separatorsEnabled(bool)),this,SLOT(enableSeparators(bool)));
24 23 dataChanged();
25 24 }
26 25
@@ -70,14 +69,14 void BarPresenterBase::dataChanged()
70 69
71 70 // Create new graphic items for bars
72 71 for (int c=0; c<mSeries->categoryCount(); c++) {
73 BarCategory *category = mSeries->categoryObject(c);
72 QString category = mSeries->categoryName(c);
74 73 for (int s=0; s<mSeries->barsetCount(); s++) {
75 74 QBarSet *set = mSeries->barsetAt(s);
76 Bar *bar = new Bar(this);
75 Bar *bar = new Bar(category,this);
77 76 childItems().append(bar);
78 77 mBars.append(bar);
79 connect(bar,SIGNAL(clicked()),set,SLOT(barClickedEvent()));
80 connect(bar,SIGNAL(rightClicked()),category,SLOT(barRightClickEvent()));
78 connect(bar,SIGNAL(clicked(QString)),set,SIGNAL(clicked(QString)));
79 connect(bar,SIGNAL(rightClicked(QString)),set,SIGNAL(rightClicked(QString)));
81 80 connect(bar,SIGNAL(hoverEntered(QPoint)),set,SLOT(barHoverEnterEvent(QPoint)));
82 81 connect(bar,SIGNAL(hoverLeaved()),set,SLOT(barHoverLeaveEvent()));
83 82 }
@@ -43,13 +43,6 void BarValue::setPos(qreal x, qreal y)
43 43 mYpos = y;
44 44 }
45 45
46 /*
47 bool BarValue::belongsToSet(QBarSet *set)
48 {
49 return (&mBarSet == set);
50 }
51 */
52
53 46 void BarValue::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
54 47 {
55 48 if (isVisible()) {
@@ -10,7 +10,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 10 class QBarSet;
11 11
12 12 // Visual class for floating bar values
13 // TODO: fonts, colors etc.
14 13 // By default these are not visible.
15 14 class BarValue : public QGraphicsObject
16 15 {
@@ -27,9 +26,6 public:
27 26 void resize(qreal w, qreal h);
28 27 void setPos(qreal x, qreal y);
29 28
30 // Propably not needed.
31 // bool belongsToSet(QBarSet *set);
32
33 29 // From QGraphicsItem
34 30 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
35 31 QRectF boundingRect() const;
@@ -2,7 +2,6
2 2 #include "qbarseries.h"
3 3 #include "qbarset.h"
4 4 #include "barchartmodel_p.h"
5 #include "barcategory_p.h"
6 5
7 6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8 7
@@ -24,22 +23,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
24 23 \brief Returns type of series.
25 24 \sa QSeries, QSeriesType
26 25 */
27 /*!
28 \fn void QBarSeries::changed(int index)
29 \brief \internal \a index
30 */
31 /*!
32 \fn void QBarSeries::floatingValuesEnabled(bool enabled)
33 \brief \internal \a enabled
34 */
35 /*!
36 \fn void QBarSeries::toolTipEnabled(bool enabled)
37 \brief \internal \a enabled
38 */
39 /*!
40 \fn void QBarSeries::separatorsEnabled(bool enabled)
41 \brief \internal \a enabled
42 */
26
43 27 /*!
44 28 \fn void QBarSeries::showToolTip(QPoint pos, QString tip)
45 29 \brief \internal \a pos \a tip
@@ -53,25 +37,29 QBarSeries::QBarSeries(QStringList categories, QObject *parent)
53 37 : QSeries(parent)
54 38 ,mModel(new BarChartModel(categories, this))
55 39 {
56 for (int i=0; i<mModel->categoryCount(); i++) {
57 BarCategory *categoryObject = mModel->categoryObject(i);
58 connect(categoryObject, SIGNAL(rightClicked(QString)), this, SIGNAL(categoryRightClicked(QString)));
59 }
60 40 }
61 41
62 42 /*!
63 Adds a set of bars to series. Takes ownership of \a set
43 Adds a set of bars to series. Takes ownership of \a set.
44 Connects the clicked(QString) and rightClicked(QString) signals
45 of \a set to this series
64 46 */
65 47 void QBarSeries::addBarSet(QBarSet *set)
66 48 {
67 49 mModel->addBarSet(set);
50 connect(set,SIGNAL(clicked(QString)),this,SLOT(barsetClicked(QString)));
51 connect(set,SIGNAL(rightClicked(QString)),this,SLOT(barsetRightClicked(QString)));
68 52 }
69 53
70 54 /*!
71 55 Removes a set of bars from series. Releases ownership of \a set. Doesnt delete \a set.
56 Disconnects the clicked(QString) and rightClicked(QString) signals
57 of \a set from this series
72 58 */
73 59 void QBarSeries::removeBarSet(QBarSet *set)
74 60 {
61 disconnect(set,SIGNAL(clicked(QString)),this,SLOT(barsetClicked(QString)));
62 disconnect(set,SIGNAL(rightClicked(QString)),this,SLOT(barsetRightClicked(QString)));
75 63 mModel->removeBarSet(set);
76 64 }
77 65
@@ -124,26 +112,6 QString QBarSeries::categoryName(int category)
124 112 }
125 113
126 114 /*!
127 Enables or disables floating values depending on parameter \a enabled.
128 Floating values are bar values, that are displayed on top of each bar.
129 Calling without parameter \a enabled, enables the floating values
130 */
131 void QBarSeries::setFloatingValuesEnabled(bool enabled)
132 {
133 if (enabled) {
134 for (int i=0; i<mModel->barsetCount(); i++) {
135 QBarSet *set = mModel->setAt(i);
136 connect(set,SIGNAL(clicked()),set,SIGNAL(toggleFloatingValues()));
137 }
138 } else {
139 for (int i=0; i<mModel->barsetCount(); i++) {
140 QBarSet *set = mModel->setAt(i);
141 disconnect(set,SIGNAL(clicked()),set,SIGNAL(toggleFloatingValues()));
142 }
143 }
144 }
145
146 /*!
147 115 Enables or disables tooltip depending on parameter \a enabled.
148 116 Tooltip shows the name of set, when mouse is hovering on top of bar.
149 117 Calling without parameter \a enabled, enables the tooltip
@@ -170,9 +138,28 void QBarSeries::setToolTipEnabled(bool enabled)
170 138 */
171 139 void QBarSeries::setSeparatorsEnabled(bool enabled)
172 140 {
173 emit separatorsEnabled(enabled);
141 // TODO: toggle
142 // emit separatorsEnabled(enabled);
174 143 }
175 144
145
146 /*!
147 \internal \a category
148 */
149 void QBarSeries::barsetClicked(QString category)
150 {
151 emit clicked(qobject_cast<QBarSet*>(sender()), category);
152 }
153
154 /*!
155 \internal \a category
156 */
157 void QBarSeries::barsetRightClicked(QString category)
158 {
159 emit rightClicked(qobject_cast<QBarSet*>(sender()), category);
160 }
161
162
176 163 /*!
177 164 \internal
178 165 */
@@ -229,12 +216,6 BarChartModel& QBarSeries::model()
229 216 return *mModel;
230 217 }
231 218
232 BarCategory* QBarSeries::categoryObject(int category)
233 {
234 return mModel->categoryObject(category);
235 }
236
237
238 219 #include "moc_qbarseries.cpp"
239 220
240 221 QTCOMMERCIALCHART_END_NAMESPACE
@@ -39,26 +39,27 public:
39 39 qreal categorySum(int category);
40 40 qreal maxCategorySum();
41 41 BarChartModel& model();
42 BarCategory* categoryObject(int category);
43 42 // <--- TO PIMPL
44 43
45 44 signals:
46 void changed(int index);
47 void categoryRightClicked(QString category);
45 //void changed(int index);
46 void clicked(QBarSet* barset, QString category); // Up to user of api, what to do with these signals
47 void rightClicked(QBarSet* barset, QString category);
48 48
49 49 // TODO: internal signals, these to private implementation.
50 50 // TODO: TO PIMPL --->
51 void floatingValuesEnabled(bool enabled);
52 void toolTipEnabled(bool enabled);
53 void separatorsEnabled(bool enabled);
54 51 void showToolTip(QPoint pos, QString tip);
55 52 // <--- TO PIMPL
56 53
57 54 public Q_SLOTS:
58 void setFloatingValuesEnabled(bool enabled=true); // enables floating values on top of bars
59 55 void setToolTipEnabled(bool enabled=true); // enables tooltips
60 56 void setSeparatorsEnabled(bool enabled=true); // enables separators between categories
61 57
58 // TODO: TO PIMPL --->
59 void barsetClicked(QString category);
60 void barsetRightClicked(QString category);
61 // <--- TO PIMPL
62
62 63 protected:
63 64 BarChartModel* mModel;
64 65 };
@@ -19,21 +19,32 QTCOMMERCIALCHART_BEGIN_NAMESPACE
19 19 */
20 20
21 21 /*!
22 \fn void QBarSet::clicked()
22 \fn void QBarSet::clicked(QString category)
23 23 \brief signals that set has been clicked
24 Parameter \a category describes on which category was clicked
24 25 */
26
27 /*!
28 \fn void QBarSet::rightClicked(QString category)
29 \brief signals that set has been clicked with right mouse button
30 Parameter \a category describes on which category was clicked
31 */
32
25 33 /*!
26 34 \fn void QBarSet::hoverEnter(QPoint pos)
27 35 \brief signals that mouse has entered over the set at position \a pos.
28 36 */
37
29 38 /*!
30 39 \fn void QBarSet::hoverLeave()
31 40 \brief signals that mouse has left from the set.
32 41 */
42
33 43 /*!
34 44 \fn void QBarSet::toggleFloatingValues()
35 45 \brief \internal
36 46 */
47
37 48 /*!
38 49 \fn void QBarSet::showToolTip(QPoint pos, QString tip)
39 50 \brief \internal \a pos \a tip
@@ -130,16 +141,20 QBrush QBarSet::brush()
130 141 return mBrush;
131 142 }
132 143
133 /*!
134 \internal
135 */
136 void QBarSet::barClickedEvent()
144 /*
145 void QBarSet::barClickedEvent(QString category)
137 146 {
138 147 // Some bar of this set has been clicked
139 148 // TODO: What happens then?
140 emit clicked(); // Notify that set has been clicked
149 emit clicked(category); // Notify that set has been clicked
141 150 }
142 151
152 void QBarSet::barRightClickedEvent(QString category)
153 {
154 emit rightClicked(category);
155 }
156 */
157
143 158 /*!
144 159 \internal \a pos
145 160 */
@@ -28,20 +28,22 public:
28 28 QBrush brush();
29 29
30 30 Q_SIGNALS:
31 void clicked(); // Clicked and hover signals exposed to user
32 void hoverEnter(QPoint pos);
33 void hoverLeave();
31 void clicked(QString category); // Clicked and hover signals exposed to user
32 void rightClicked(QString category);
33 void toggleFloatingValues();
34 34
35 35 // TODO: Expose this to user or not?
36 36 // TODO: TO PIMPL --->
37 void toggleFloatingValues();
37 void hoverEnter(QPoint pos);
38 void hoverLeave();
38 39 void showToolTip(QPoint pos, QString tip); // Private signal
39 40 // <--- TO PIMPL
40 41
41 42 public Q_SLOTS:
42 43 // These are for internal communication
43 44 // TODO: TO PIMPL --->
44 void barClickedEvent();
45 // void barClickedEvent(QString category);
46 // void barRightClickedEvent(QString category);
45 47 void barHoverEnterEvent(QPoint pos);
46 48 void barHoverLeaveEvent();
47 49 // <--- TO PIMPL
@@ -146,7 +146,7 void ChartPresenter::handleSeriesAdded(QSeries* series)
146 146 BarPresenter* item = new BarPresenter(barSeries,m_chart);
147 147 m_chartTheme->decorate(item,barSeries,m_chartItems.count());
148 148 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&)));
149 QObject::connect(barSeries,SIGNAL(changed(int)),item,SLOT(handleModelChanged(int)));
149 // QObject::connect(barSeries,SIGNAL(changed(int)),item,SLOT(handleModelChanged(int)));
150 150 m_chartItems.insert(series,item);
151 151 // m_axisXItem->setVisible(false);
152 152 if(m_rect.isValid()) item->handleGeometryChanged(m_rect);
@@ -159,7 +159,7 void ChartPresenter::handleSeriesAdded(QSeries* series)
159 159 StackedBarPresenter* item = new StackedBarPresenter(stackedBarSeries,m_chart);
160 160 m_chartTheme->decorate(item,stackedBarSeries,m_chartItems.count());
161 161 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&)));
162 QObject::connect(stackedBarSeries,SIGNAL(changed(int)),item,SLOT(handleModelChanged(int)));
162 // QObject::connect(stackedBarSeries,SIGNAL(changed(int)),item,SLOT(handleModelChanged(int)));
163 163 m_chartItems.insert(series,item);
164 164 if(m_rect.isValid()) item->handleGeometryChanged(m_rect);
165 165 break;
@@ -171,7 +171,7 void ChartPresenter::handleSeriesAdded(QSeries* series)
171 171 PercentBarPresenter* item = new PercentBarPresenter(percentBarSeries,m_chart);
172 172 m_chartTheme->decorate(item,percentBarSeries ,m_chartItems.count());
173 173 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&)));
174 QObject::connect(percentBarSeries,SIGNAL(changed(int)),item,SLOT(handleModelChanged(int)));
174 // QObject::connect(percentBarSeries,SIGNAL(changed(int)),item,SLOT(handleModelChanged(int)));
175 175 m_chartItems.insert(series,item);
176 176 if(m_rect.isValid()) item->handleGeometryChanged(m_rect);
177 177 break;
@@ -290,7 +290,8 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
290 290 }
291 291 series->addBarSet(set);
292 292 }
293 series->setFloatingValuesEnabled(true);
293 // TODO: new implementation of setFloatingValuesEnabled with signals
294 //series->setFloatingValuesEnabled(true);
294 295 series->setToolTipEnabled(true);
295 296 series->setSeparatorsEnabled(false);
296 297 m_chartView->addSeries(series);
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now