@@ -194,7 +194,7 void TableWidget::updateChartType() | |||||
194 | // pie 1 |
|
194 | // pie 1 | |
195 | QPieSeries* pieSeries = new QPieSeries; |
|
195 | QPieSeries* pieSeries = new QPieSeries; | |
196 | pieSeries->setModel(m_model); |
|
196 | pieSeries->setModel(m_model); | |
197 |
pieSeries->setModelMapping(0,0, Qt:: |
|
197 | pieSeries->setModelMapping(0,0, Qt::Vertical); | |
198 | pieSeries->setLabelsVisible(true); |
|
198 | pieSeries->setLabelsVisible(true); | |
199 | pieSeries->setPieSize(0.4); |
|
199 | pieSeries->setPieSize(0.4); | |
200 | pieSeries->setPiePosition(0.2, 0.35); |
|
200 | pieSeries->setPiePosition(0.2, 0.35); | |
@@ -203,7 +203,7 void TableWidget::updateChartType() | |||||
203 | // pie 2 |
|
203 | // pie 2 | |
204 | pieSeries = new QPieSeries; |
|
204 | pieSeries = new QPieSeries; | |
205 | pieSeries->setModel(m_model); |
|
205 | pieSeries->setModel(m_model); | |
206 |
pieSeries->setModelMapping(1,1, Qt:: |
|
206 | pieSeries->setModelMapping(1,1, Qt::Vertical); | |
207 | pieSeries->setLabelsVisible(true); |
|
207 | pieSeries->setLabelsVisible(true); | |
208 | pieSeries->setPieSize(0.4); |
|
208 | pieSeries->setPieSize(0.4); | |
209 | pieSeries->setPiePosition(0.8, 0.35); |
|
209 | pieSeries->setPiePosition(0.8, 0.35); | |
@@ -212,7 +212,7 void TableWidget::updateChartType() | |||||
212 | // pie 3 |
|
212 | // pie 3 | |
213 | pieSeries = new QPieSeries; |
|
213 | pieSeries = new QPieSeries; | |
214 | pieSeries->setModel(m_model); |
|
214 | pieSeries->setModel(m_model); | |
215 |
pieSeries->setModelMapping(2,2, Qt:: |
|
215 | pieSeries->setModelMapping(2,2, Qt::Vertical); | |
216 | pieSeries->setLabelsVisible(true); |
|
216 | pieSeries->setLabelsVisible(true); | |
217 | pieSeries->setPieSize(0.4); |
|
217 | pieSeries->setPieSize(0.4); | |
218 | pieSeries->setPiePosition(0.5, 0.65); |
|
218 | pieSeries->setPiePosition(0.5, 0.65); |
@@ -8,7 +8,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
8 |
|
8 | |||
9 | BarPresenter::BarPresenter(QBarSeries *series, QChart *parent) : |
|
9 | BarPresenter::BarPresenter(QBarSeries *series, QChart *parent) : | |
10 | BarPresenterBase(series, parent) |
|
10 | BarPresenterBase(series, parent) | |
11 | { |
|
11 | { | |
|
12 | connect(series, SIGNAL(updatedBars()), this, SLOT(layoutChanged())); | |||
12 | } |
|
13 | } | |
13 |
|
14 | |||
14 | void BarPresenter::layoutChanged() |
|
15 | void BarPresenter::layoutChanged() | |
@@ -78,6 +79,7 void BarPresenter::layoutChanged() | |||||
78 | xPos += mBarWidth; |
|
79 | xPos += mBarWidth; | |
79 | } |
|
80 | } | |
80 | } |
|
81 | } | |
|
82 | update(); | |||
81 | } |
|
83 | } | |
82 |
|
84 | |||
83 | #include "moc_barpresenter_p.cpp" |
|
85 | #include "moc_barpresenter_p.cpp" |
@@ -30,6 +30,7 public: | |||||
30 |
|
30 | |||
31 | // TODO: Consider the domain for layoutChanged. May be use case, may not be. If it is, then the derived classes need to implement it |
|
31 | // TODO: Consider the domain for layoutChanged. May be use case, may not be. If it is, then the derived classes need to implement it | |
32 | virtual void dataChanged(); // data of series has changed -> need to recalculate bar sizes |
|
32 | virtual void dataChanged(); // data of series has changed -> need to recalculate bar sizes | |
|
33 | private slots: | |||
33 | virtual void layoutChanged() = 0; // layout has changed -> need to recalculate bar sizes |
|
34 | virtual void layoutChanged() = 0; // layout has changed -> need to recalculate bar sizes | |
34 |
|
35 | |||
35 | protected: |
|
36 | protected: |
@@ -54,7 +54,7 void QBarSeries::addBarSet(QBarSet *set) | |||||
54 | mModel->addBarSet(set); |
|
54 | mModel->addBarSet(set); | |
55 | connect(set,SIGNAL(clicked(QString)),this,SLOT(barsetClicked(QString))); |
|
55 | connect(set,SIGNAL(clicked(QString)),this,SLOT(barsetClicked(QString))); | |
56 | connect(set,SIGNAL(rightClicked(QString)),this,SLOT(barsetRightClicked(QString))); |
|
56 | connect(set,SIGNAL(rightClicked(QString)),this,SLOT(barsetRightClicked(QString))); | |
57 |
connect(set, SIGNAL( |
|
57 | connect(set, SIGNAL(valueChanged()), this, SLOT(barsetChanged())); | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 | /*! |
|
60 | /*! | |
@@ -323,7 +323,7 void QBarSeries::modelDataRemoved(QModelIndex /*parent*/, int /*start*/, int /*e | |||||
323 |
|
323 | |||
324 | void QBarSeries::barsetChanged() |
|
324 | void QBarSeries::barsetChanged() | |
325 | { |
|
325 | { | |
326 | // mModel-> |
|
326 | emit updatedBars(); | |
327 | } |
|
327 | } | |
328 |
|
328 | |||
329 | #include "moc_qbarseries.cpp" |
|
329 | #include "moc_qbarseries.cpp" |
@@ -49,6 +49,9 signals: | |||||
49 | void clicked(QBarSet* barset, QString category); // Up to user of api, what to do with these signals |
|
49 | void clicked(QBarSet* barset, QString category); // Up to user of api, what to do with these signals | |
50 | void rightClicked(QBarSet* barset, QString category); |
|
50 | void rightClicked(QBarSet* barset, QString category); | |
51 |
|
51 | |||
|
52 | // | |||
|
53 | void updatedBars(); | |||
|
54 | ||||
52 | // TODO: internal signals, these to private implementation. |
|
55 | // TODO: internal signals, these to private implementation. | |
53 | // TODO: TO PIMPL ---> |
|
56 | // TODO: TO PIMPL ---> | |
54 | void showToolTip(QPoint pos, QString tip); |
|
57 | void showToolTip(QPoint pos, QString tip); | |
@@ -72,7 +75,7 private Q_SLOTS: | |||||
72 | protected: |
|
75 | protected: | |
73 | BarChartModel* mModel; |
|
76 | BarChartModel* mModel; | |
74 |
|
77 | |||
75 | QAbstractItemModel* m_model; |
|
78 | // QAbstractItemModel* m_model; | |
76 | int m_mapCategories; |
|
79 | int m_mapCategories; | |
77 | int m_mapBarBottom; |
|
80 | int m_mapBarBottom; | |
78 | int m_mapBarTop; |
|
81 | int m_mapBarTop; |
@@ -82,6 +82,7 QString QBarSet::name() | |||||
82 | QBarSet& QBarSet::operator << (const qreal &value) |
|
82 | QBarSet& QBarSet::operator << (const qreal &value) | |
83 | { |
|
83 | { | |
84 | mValues.append(value); |
|
84 | mValues.append(value); | |
|
85 | emit structureChanged(); | |||
85 | return *this; |
|
86 | return *this; | |
86 | } |
|
87 | } | |
87 |
|
88 | |||
@@ -107,7 +108,7 qreal QBarSet::valueAt(int index) | |||||
107 | void QBarSet::setValue(int index, qreal value) |
|
108 | void QBarSet::setValue(int index, qreal value) | |
108 | { |
|
109 | { | |
109 | mValues.replace(index,value); |
|
110 | mValues.replace(index,value); | |
110 |
emit |
|
111 | emit valueChanged(); | |
111 | } |
|
112 | } | |
112 |
|
113 | |||
113 | /*! |
|
114 | /*! | |
@@ -128,7 +129,7 qreal QBarSet::total() | |||||
128 | void QBarSet::setPen(const QPen pen) |
|
129 | void QBarSet::setPen(const QPen pen) | |
129 | { |
|
130 | { | |
130 | mPen = pen; |
|
131 | mPen = pen; | |
131 |
emit |
|
132 | emit valueChanged(); | |
132 | } |
|
133 | } | |
133 |
|
134 | |||
134 | /*! |
|
135 | /*! | |
@@ -145,7 +146,7 QPen QBarSet::pen() const | |||||
145 | void QBarSet::setBrush(const QBrush brush) |
|
146 | void QBarSet::setBrush(const QBrush brush) | |
146 | { |
|
147 | { | |
147 | mBrush = brush; |
|
148 | mBrush = brush; | |
148 |
emit |
|
149 | emit valueChanged(); | |
149 | } |
|
150 | } | |
150 |
|
151 | |||
151 | /*! |
|
152 | /*! |
@@ -43,7 +43,8 Q_SIGNALS: | |||||
43 |
|
43 | |||
44 | // TODO: Expose this to user or not? |
|
44 | // TODO: Expose this to user or not? | |
45 | // TODO: TO PIMPL ---> |
|
45 | // TODO: TO PIMPL ---> | |
46 | void changed(); |
|
46 | void structureChanged(); | |
|
47 | void valueChanged(); | |||
47 | void hoverEnter(QPoint pos); |
|
48 | void hoverEnter(QPoint pos); | |
48 | void hoverLeave(); |
|
49 | void hoverLeave(); | |
49 | void showToolTip(QPoint pos, QString tip); // Private signal |
|
50 | void showToolTip(QPoint pos, QString tip); // Private signal |
General Comments 0
You need to be logged in to leave comments.
Login now