@@ -49,7 +49,6 int main(int argc, char *argv[]) | |||||
49 | //! [4] |
|
49 | //! [4] | |
50 | // Enable tooltip |
|
50 | // Enable tooltip | |
51 | series->setToolTipEnabled(); |
|
51 | series->setToolTipEnabled(); | |
52 | series->setSeparatorsVisible(true); |
|
|||
53 |
|
52 | |||
54 | // Connect clicked signal of set to toggle floating values of set. |
|
53 | // Connect clicked signal of set to toggle floating values of set. | |
55 | QObject::connect(set0,SIGNAL(clicked(QString)),set0,SIGNAL(toggleFloatingValues())); |
|
54 | QObject::connect(set0,SIGNAL(clicked(QString)),set0,SIGNAL(toggleFloatingValues())); |
@@ -11,7 +11,6 SOURCES += \ | |||||
11 | $$PWD/qbarset.cpp \ |
|
11 | $$PWD/qbarset.cpp \ | |
12 | $$PWD/qpercentbarseries.cpp \ |
|
12 | $$PWD/qpercentbarseries.cpp \ | |
13 | $$PWD/qstackedbarseries.cpp \ |
|
13 | $$PWD/qstackedbarseries.cpp \ | |
14 | $$PWD/separator.cpp \ |
|
|||
15 | $$PWD/stackedbarpresenter.cpp \ |
|
14 | $$PWD/stackedbarpresenter.cpp \ | |
16 | $$PWD/barvalue.cpp |
|
15 | $$PWD/barvalue.cpp | |
17 |
|
16 | |||
@@ -21,7 +20,6 PRIVATE_HEADERS += \ | |||||
21 | $$PWD/barpresenter_p.h \ |
|
20 | $$PWD/barpresenter_p.h \ | |
22 | $$PWD/barpresenterbase_p.h \ |
|
21 | $$PWD/barpresenterbase_p.h \ | |
23 | $$PWD/percentbarpresenter_p.h \ |
|
22 | $$PWD/percentbarpresenter_p.h \ | |
24 | $$PWD/separator_p.h \ |
|
|||
25 | $$PWD/stackedbarpresenter_p.h \ |
|
23 | $$PWD/stackedbarpresenter_p.h \ | |
26 | $$PWD/barvalue_p.h |
|
24 | $$PWD/barvalue_p.h | |
27 |
|
25 |
@@ -1,7 +1,6 | |||||
1 | #include "barpresenter_p.h" |
|
1 | #include "barpresenter_p.h" | |
2 | #include "bar_p.h" |
|
2 | #include "bar_p.h" | |
3 | #include "barvalue_p.h" |
|
3 | #include "barvalue_p.h" | |
4 | #include "separator_p.h" |
|
|||
5 | #include "qbarset.h" |
|
4 | #include "qbarset.h" | |
6 | #include <QDebug> |
|
5 | #include <QDebug> | |
7 |
|
6 | |||
@@ -54,17 +53,7 void BarPresenter::layoutChanged() | |||||
54 | xPos += mBarWidth; |
|
53 | xPos += mBarWidth; | |
55 | } |
|
54 | } | |
56 | } |
|
55 | } | |
57 | /* |
|
56 | ||
58 | // Position separators |
|
|||
59 | qreal xPos = categoryWidth + categoryWidth/2; |
|
|||
60 | for (int s=0; s < mSeparators.count(); s++) { |
|
|||
61 | Separator* sep = mSeparators.at(s); |
|
|||
62 | sep->setPos(xPos,0); |
|
|||
63 | sep->setSize(QSizeF(1,mHeight)); |
|
|||
64 | sep->setColor(QColor(255,0,0,255)); // TODO: color for separations from theme |
|
|||
65 | xPos += categoryWidth; |
|
|||
66 | } |
|
|||
67 | */ |
|
|||
68 | // Position floating values |
|
57 | // Position floating values | |
69 | itemIndex = 0; |
|
58 | itemIndex = 0; | |
70 | for (int category=0; category < mSeries->categoryCount(); category++) { |
|
59 | for (int category=0; category < mSeries->categoryCount(); category++) { |
@@ -1,7 +1,6 | |||||
1 | #include "barpresenterbase_p.h" |
|
1 | #include "barpresenterbase_p.h" | |
2 | #include "bar_p.h" |
|
2 | #include "bar_p.h" | |
3 | #include "barvalue_p.h" |
|
3 | #include "barvalue_p.h" | |
4 | #include "separator_p.h" |
|
|||
5 | #include "qbarset.h" |
|
4 | #include "qbarset.h" | |
6 | #include "qbarseries.h" |
|
5 | #include "qbarseries.h" | |
7 | #include "qchart.h" |
|
6 | #include "qchart.h" | |
@@ -22,8 +21,6 BarPresenterBase::BarPresenterBase(QBarSeries *series, QChart *parent) : | |||||
22 | mChart(parent) |
|
21 | mChart(parent) | |
23 | { |
|
22 | { | |
24 | connect(series,SIGNAL(showToolTip(QPoint,QString)),this,SLOT(showToolTip(QPoint,QString))); |
|
23 | connect(series,SIGNAL(showToolTip(QPoint,QString)),this,SLOT(showToolTip(QPoint,QString))); | |
25 | // connect(series,SIGNAL(enableSeparators(bool)),this,SLOT(enableSeparators(bool))); |
|
|||
26 | // enableSeparators(series->separatorsVisible()); |
|
|||
27 | setZValue(ChartPresenter::BarSeriesZValue); |
|
24 | setZValue(ChartPresenter::BarSeriesZValue); | |
28 | initAxisLabels(); |
|
25 | initAxisLabels(); | |
29 | dataChanged(); |
|
26 | dataChanged(); | |
@@ -32,7 +29,6 BarPresenterBase::BarPresenterBase(QBarSeries *series, QChart *parent) : | |||||
32 | BarPresenterBase::~BarPresenterBase() |
|
29 | BarPresenterBase::~BarPresenterBase() | |
33 | { |
|
30 | { | |
34 | disconnect(this,SLOT(showToolTip(QPoint,QString))); |
|
31 | disconnect(this,SLOT(showToolTip(QPoint,QString))); | |
35 | // disconnect(this,SLOT(enableSeparators(bool))); |
|
|||
36 | } |
|
32 | } | |
37 |
|
33 | |||
38 | void BarPresenterBase::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
34 | void BarPresenterBase::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | |
@@ -60,7 +56,6 void BarPresenterBase::dataChanged() | |||||
60 | } |
|
56 | } | |
61 |
|
57 | |||
62 | mBars.clear(); |
|
58 | mBars.clear(); | |
63 | // mSeparators.clear(); |
|
|||
64 | mFloatingValues.clear(); |
|
59 | mFloatingValues.clear(); | |
65 |
|
60 | |||
66 | // Create new graphic items for bars |
|
61 | // Create new graphic items for bars | |
@@ -77,16 +72,7 void BarPresenterBase::dataChanged() | |||||
77 | connect(bar,SIGNAL(hoverLeaved()),set,SLOT(barHoverLeaveEvent())); |
|
72 | connect(bar,SIGNAL(hoverLeaved()),set,SLOT(barHoverLeaveEvent())); | |
78 | } |
|
73 | } | |
79 | } |
|
74 | } | |
80 | /* |
|
75 | ||
81 | // Create separators |
|
|||
82 | int count = mSeries->categoryCount() - 1; // There is one less separator than columns |
|
|||
83 | for (int i=0; i<count; i++) { |
|
|||
84 | Separator* sep = new Separator(this); |
|
|||
85 | sep->setVisible(mSeries->separatorsVisible()); |
|
|||
86 | childItems().append(sep); |
|
|||
87 | mSeparators.append(sep); |
|
|||
88 | } |
|
|||
89 | */ |
|
|||
90 | // Create floating values |
|
76 | // Create floating values | |
91 | for (int category=0; category<mSeries->categoryCount(); category++) { |
|
77 | for (int category=0; category<mSeries->categoryCount(); category++) { | |
92 | for (int s=0; s<mSeries->barsetCount(); s++) { |
|
78 | for (int s=0; s<mSeries->barsetCount(); s++) { | |
@@ -175,15 +161,6 void BarPresenterBase::showToolTip(QPoint pos, QString tip) | |||||
175 | QToolTip::showText(pos,tip); |
|
161 | QToolTip::showText(pos,tip); | |
176 | } |
|
162 | } | |
177 |
|
163 | |||
178 | /* |
|
|||
179 | void BarPresenterBase::enableSeparators(bool enabled) |
|
|||
180 | { |
|
|||
181 | for (int i=0; i<mSeparators.count(); i++) { |
|
|||
182 | mSeparators.at(i)->setVisible(enabled); |
|
|||
183 | } |
|
|||
184 | } |
|
|||
185 | */ |
|
|||
186 |
|
||||
187 | #include "moc_barpresenterbase_p.cpp" |
|
164 | #include "moc_barpresenterbase_p.cpp" | |
188 |
|
165 | |||
189 | QTCOMMERCIALCHART_END_NAMESPACE |
|
166 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -10,7 +10,6 | |||||
10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
11 |
|
11 | |||
12 | class Bar; |
|
12 | class Bar; | |
13 | class Separator; |
|
|||
14 | class BarValue; |
|
13 | class BarValue; | |
15 | class QChartAxisCategories; |
|
14 | class QChartAxisCategories; | |
16 | class QChart; |
|
15 | class QChart; | |
@@ -43,7 +42,6 public slots: | |||||
43 |
|
42 | |||
44 | // Internal slots |
|
43 | // Internal slots | |
45 | void showToolTip(QPoint pos, QString tip); // shows tooltip (if enabled) |
|
44 | void showToolTip(QPoint pos, QString tip); // shows tooltip (if enabled) | |
46 | // void enableSeparators(bool enabled); |
|
|||
47 |
|
45 | |||
48 | protected: |
|
46 | protected: | |
49 |
|
47 | |||
@@ -57,7 +55,6 protected: | |||||
57 | // Not owned. |
|
55 | // Not owned. | |
58 | QBarSeries* mSeries; |
|
56 | QBarSeries* mSeries; | |
59 | QList<Bar*> mBars; |
|
57 | QList<Bar*> mBars; | |
60 | // QList<Separator*> mSeparators; |
|
|||
61 | QList<BarValue*> mFloatingValues; |
|
58 | QList<BarValue*> mFloatingValues; | |
62 | QChart* mChart; |
|
59 | QChart* mChart; | |
63 | }; |
|
60 | }; |
@@ -1,7 +1,6 | |||||
1 | #include "percentbarpresenter_p.h" |
|
1 | #include "percentbarpresenter_p.h" | |
2 | #include "bar_p.h" |
|
2 | #include "bar_p.h" | |
3 | #include "barvalue_p.h" |
|
3 | #include "barvalue_p.h" | |
4 | #include "separator_p.h" |
|
|||
5 | #include "qbarset.h" |
|
4 | #include "qbarset.h" | |
6 | #include <QDebug> |
|
5 | #include <QDebug> | |
7 |
|
6 | |||
@@ -56,16 +55,7 void PercentBarPresenter::layoutChanged() | |||||
56 | } |
|
55 | } | |
57 | xPos += xStep; |
|
56 | xPos += xStep; | |
58 | } |
|
57 | } | |
59 | /* |
|
58 | ||
60 | // Position separators |
|
|||
61 | xPos = xStep + xStep/2; |
|
|||
62 | for (int s=0; s < mSeries->categoryCount() - 1; s++) { |
|
|||
63 | Separator* sep = mSeparators.at(s); |
|
|||
64 | sep->setPos(xPos,0); |
|
|||
65 | sep->setSize(QSizeF(1,mHeight)); |
|
|||
66 | xPos += xStep; |
|
|||
67 | } |
|
|||
68 | */ |
|
|||
69 | // Position floating values |
|
59 | // Position floating values | |
70 | itemIndex = 0; |
|
60 | itemIndex = 0; | |
71 | xPos = (tW/tC); |
|
61 | xPos = (tW/tC); |
@@ -133,17 +133,6 void QBarSeries::setToolTipEnabled(bool enabled) | |||||
133 | } |
|
133 | } | |
134 | } |
|
134 | } | |
135 |
|
135 | |||
136 | /*! |
|
|||
137 | Enables or disables separators depending on parameter \a enabled. |
|
|||
138 | Separators are visual elements that are drawn between categories. |
|
|||
139 | Calling without parameter \a enabled, enables the separators |
|
|||
140 | */ |
|
|||
141 | void QBarSeries::setSeparatorsVisible(bool visible) |
|
|||
142 | { |
|
|||
143 | mSeparatorsVisible = visible; |
|
|||
144 | emit enableSeparators(visible); |
|
|||
145 | } |
|
|||
146 |
|
||||
147 |
|
136 | |||
148 | /*! |
|
137 | /*! | |
149 | \internal \a category |
|
138 | \internal \a category | |
@@ -218,11 +207,6 BarChartModel& QBarSeries::model() | |||||
218 | return *mModel; |
|
207 | return *mModel; | |
219 | } |
|
208 | } | |
220 |
|
209 | |||
221 | bool QBarSeries::separatorsVisible() |
|
|||
222 | { |
|
|||
223 | return mSeparatorsVisible; |
|
|||
224 | } |
|
|||
225 |
|
||||
226 | bool QBarSeries::setModel(QAbstractItemModel* model) |
|
210 | bool QBarSeries::setModel(QAbstractItemModel* model) | |
227 | { |
|
211 | { | |
228 | // disconnect signals from old model |
|
212 | // disconnect signals from old model |
@@ -42,7 +42,6 public: | |||||
42 | qreal categorySum(int category); |
|
42 | qreal categorySum(int category); | |
43 | qreal maxCategorySum(); |
|
43 | qreal maxCategorySum(); | |
44 | BarChartModel& model(); |
|
44 | BarChartModel& model(); | |
45 | bool separatorsVisible(); |
|
|||
46 | // <--- TO PIMPL |
|
45 | // <--- TO PIMPL | |
47 |
|
46 | |||
48 | signals: |
|
47 | signals: | |
@@ -52,13 +51,11 signals: | |||||
52 |
|
51 | |||
53 | // TODO: internal signals, these to private implementation. |
|
52 | // TODO: internal signals, these to private implementation. | |
54 | // TODO: TO PIMPL ---> |
|
53 | // TODO: TO PIMPL ---> | |
55 | void enableSeparators(bool enable); |
|
|||
56 | void showToolTip(QPoint pos, QString tip); |
|
54 | void showToolTip(QPoint pos, QString tip); | |
57 | // <--- TO PIMPL |
|
55 | // <--- TO PIMPL | |
58 |
|
56 | |||
59 | public Q_SLOTS: |
|
57 | public Q_SLOTS: | |
60 | void setToolTipEnabled(bool enabled=true); // enables tooltips |
|
58 | void setToolTipEnabled(bool enabled=true); // enables tooltips | |
61 | void setSeparatorsVisible(bool visible=true); // enables separators between categories |
|
|||
62 |
|
59 | |||
63 | // TODO: TO PIMPL ---> |
|
60 | // TODO: TO PIMPL ---> | |
64 | void barsetClicked(QString category); |
|
61 | void barsetClicked(QString category); | |
@@ -74,7 +71,6 private Q_SLOTS: | |||||
74 |
|
71 | |||
75 | protected: |
|
72 | protected: | |
76 | BarChartModel* mModel; |
|
73 | BarChartModel* mModel; | |
77 | bool mSeparatorsVisible; |
|
|||
78 |
|
74 | |||
79 | QAbstractItemModel* m_model; |
|
75 | QAbstractItemModel* m_model; | |
80 | int m_mapCategories; |
|
76 | int m_mapCategories; |
@@ -1,7 +1,6 | |||||
1 | #include "stackedbarpresenter_p.h" |
|
1 | #include "stackedbarpresenter_p.h" | |
2 | #include "bar_p.h" |
|
2 | #include "bar_p.h" | |
3 | #include "barvalue_p.h" |
|
3 | #include "barvalue_p.h" | |
4 | #include "separator_p.h" |
|
|||
5 | #include "qbarset.h" |
|
4 | #include "qbarset.h" | |
6 | #include <QDebug> |
|
5 | #include <QDebug> | |
7 |
|
6 | |||
@@ -64,16 +63,7 void StackedBarPresenter::layoutChanged() | |||||
64 | } |
|
63 | } | |
65 | xPos += xStep; |
|
64 | xPos += xStep; | |
66 | } |
|
65 | } | |
67 | /* |
|
66 | ||
68 | // Position separators |
|
|||
69 | xPos = xStep + xStep/2; |
|
|||
70 | for (int s=0; s < mSeries->categoryCount() - 1; s++) { |
|
|||
71 | Separator* sep = mSeparators.at(s); |
|
|||
72 | sep->setPos(xPos,0); |
|
|||
73 | sep->setSize(QSizeF(1,mHeight)); |
|
|||
74 | xPos += xStep; |
|
|||
75 | } |
|
|||
76 | */ |
|
|||
77 | // Position floating values |
|
67 | // Position floating values | |
78 | itemIndex = 0; |
|
68 | itemIndex = 0; | |
79 | xPos = (tW/tC); |
|
69 | xPos = (tW/tC); |
@@ -268,7 +268,6 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS | |||||
268 | // TODO: new implementation of setFloatingValuesEnabled with signals |
|
268 | // TODO: new implementation of setFloatingValuesEnabled with signals | |
269 | //series->setFloatingValuesEnabled(true); |
|
269 | //series->setFloatingValuesEnabled(true); | |
270 | series->setToolTipEnabled(true); |
|
270 | series->setToolTipEnabled(true); | |
271 | series->setSeparatorsVisible(false); |
|
|||
272 | m_chartView->addSeries(series); |
|
271 | m_chartView->addSeries(series); | |
273 | } else if (seriesName == "Spline") { |
|
272 | } else if (seriesName == "Spline") { | |
274 | for (int j(0); j < data.count(); j ++) { |
|
273 | for (int j(0); j < data.count(); j ++) { |
General Comments 0
You need to be logged in to leave comments.
Login now