@@ -49,7 +49,6 int main(int argc, char *argv[]) | |||
|
49 | 49 | //! [4] |
|
50 | 50 | // Enable tooltip |
|
51 | 51 | series->setToolTipEnabled(); |
|
52 | series->setSeparatorsVisible(true); | |
|
53 | 52 | |
|
54 | 53 | // Connect clicked signal of set to toggle floating values of set. |
|
55 | 54 | QObject::connect(set0,SIGNAL(clicked(QString)),set0,SIGNAL(toggleFloatingValues())); |
@@ -11,7 +11,6 SOURCES += \ | |||
|
11 | 11 | $$PWD/qbarset.cpp \ |
|
12 | 12 | $$PWD/qpercentbarseries.cpp \ |
|
13 | 13 | $$PWD/qstackedbarseries.cpp \ |
|
14 | $$PWD/separator.cpp \ | |
|
15 | 14 | $$PWD/stackedbarpresenter.cpp \ |
|
16 | 15 | $$PWD/barvalue.cpp |
|
17 | 16 | |
@@ -21,7 +20,6 PRIVATE_HEADERS += \ | |||
|
21 | 20 | $$PWD/barpresenter_p.h \ |
|
22 | 21 | $$PWD/barpresenterbase_p.h \ |
|
23 | 22 | $$PWD/percentbarpresenter_p.h \ |
|
24 | $$PWD/separator_p.h \ | |
|
25 | 23 | $$PWD/stackedbarpresenter_p.h \ |
|
26 | 24 | $$PWD/barvalue_p.h |
|
27 | 25 |
@@ -1,7 +1,6 | |||
|
1 | 1 | #include "barpresenter_p.h" |
|
2 | 2 | #include "bar_p.h" |
|
3 | 3 | #include "barvalue_p.h" |
|
4 | #include "separator_p.h" | |
|
5 | 4 | #include "qbarset.h" |
|
6 | 5 | #include <QDebug> |
|
7 | 6 | |
@@ -54,17 +53,7 void BarPresenter::layoutChanged() | |||
|
54 | 53 | xPos += mBarWidth; |
|
55 | 54 | } |
|
56 | 55 | } |
|
57 | /* | |
|
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 | */ | |
|
56 | ||
|
68 | 57 | // Position floating values |
|
69 | 58 | itemIndex = 0; |
|
70 | 59 | for (int category=0; category < mSeries->categoryCount(); category++) { |
@@ -1,7 +1,6 | |||
|
1 | 1 | #include "barpresenterbase_p.h" |
|
2 | 2 | #include "bar_p.h" |
|
3 | 3 | #include "barvalue_p.h" |
|
4 | #include "separator_p.h" | |
|
5 | 4 | #include "qbarset.h" |
|
6 | 5 | #include "qbarseries.h" |
|
7 | 6 | #include "qchart.h" |
@@ -22,8 +21,6 BarPresenterBase::BarPresenterBase(QBarSeries *series, QChart *parent) : | |||
|
22 | 21 | mChart(parent) |
|
23 | 22 | { |
|
24 | 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 | 24 | setZValue(ChartPresenter::BarSeriesZValue); |
|
28 | 25 | initAxisLabels(); |
|
29 | 26 | dataChanged(); |
@@ -32,7 +29,6 BarPresenterBase::BarPresenterBase(QBarSeries *series, QChart *parent) : | |||
|
32 | 29 | BarPresenterBase::~BarPresenterBase() |
|
33 | 30 | { |
|
34 | 31 | disconnect(this,SLOT(showToolTip(QPoint,QString))); |
|
35 | // disconnect(this,SLOT(enableSeparators(bool))); | |
|
36 | 32 | } |
|
37 | 33 | |
|
38 | 34 | void BarPresenterBase::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
@@ -60,7 +56,6 void BarPresenterBase::dataChanged() | |||
|
60 | 56 | } |
|
61 | 57 | |
|
62 | 58 | mBars.clear(); |
|
63 | // mSeparators.clear(); | |
|
64 | 59 | mFloatingValues.clear(); |
|
65 | 60 | |
|
66 | 61 | // Create new graphic items for bars |
@@ -77,16 +72,7 void BarPresenterBase::dataChanged() | |||
|
77 | 72 | connect(bar,SIGNAL(hoverLeaved()),set,SLOT(barHoverLeaveEvent())); |
|
78 | 73 | } |
|
79 | 74 | } |
|
80 | /* | |
|
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 | */ | |
|
75 | ||
|
90 | 76 | // Create floating values |
|
91 | 77 | for (int category=0; category<mSeries->categoryCount(); category++) { |
|
92 | 78 | for (int s=0; s<mSeries->barsetCount(); s++) { |
@@ -175,15 +161,6 void BarPresenterBase::showToolTip(QPoint pos, QString tip) | |||
|
175 | 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 | 164 | #include "moc_barpresenterbase_p.cpp" |
|
188 | 165 | |
|
189 | 166 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -10,7 +10,6 | |||
|
10 | 10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
11 | 11 | |
|
12 | 12 | class Bar; |
|
13 | class Separator; | |
|
14 | 13 | class BarValue; |
|
15 | 14 | class QChartAxisCategories; |
|
16 | 15 | class QChart; |
@@ -43,7 +42,6 public slots: | |||
|
43 | 42 | |
|
44 | 43 | // Internal slots |
|
45 | 44 | void showToolTip(QPoint pos, QString tip); // shows tooltip (if enabled) |
|
46 | // void enableSeparators(bool enabled); | |
|
47 | 45 | |
|
48 | 46 | protected: |
|
49 | 47 | |
@@ -57,7 +55,6 protected: | |||
|
57 | 55 | // Not owned. |
|
58 | 56 | QBarSeries* mSeries; |
|
59 | 57 | QList<Bar*> mBars; |
|
60 | // QList<Separator*> mSeparators; | |
|
61 | 58 | QList<BarValue*> mFloatingValues; |
|
62 | 59 | QChart* mChart; |
|
63 | 60 | }; |
@@ -1,7 +1,6 | |||
|
1 | 1 | #include "percentbarpresenter_p.h" |
|
2 | 2 | #include "bar_p.h" |
|
3 | 3 | #include "barvalue_p.h" |
|
4 | #include "separator_p.h" | |
|
5 | 4 | #include "qbarset.h" |
|
6 | 5 | #include <QDebug> |
|
7 | 6 | |
@@ -56,16 +55,7 void PercentBarPresenter::layoutChanged() | |||
|
56 | 55 | } |
|
57 | 56 | xPos += xStep; |
|
58 | 57 | } |
|
59 | /* | |
|
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 | */ | |
|
58 | ||
|
69 | 59 | // Position floating values |
|
70 | 60 | itemIndex = 0; |
|
71 | 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 | 138 | \internal \a category |
@@ -218,11 +207,6 BarChartModel& QBarSeries::model() | |||
|
218 | 207 | return *mModel; |
|
219 | 208 | } |
|
220 | 209 | |
|
221 | bool QBarSeries::separatorsVisible() | |
|
222 | { | |
|
223 | return mSeparatorsVisible; | |
|
224 | } | |
|
225 | ||
|
226 | 210 | bool QBarSeries::setModel(QAbstractItemModel* model) |
|
227 | 211 | { |
|
228 | 212 | // disconnect signals from old model |
@@ -42,7 +42,6 public: | |||
|
42 | 42 | qreal categorySum(int category); |
|
43 | 43 | qreal maxCategorySum(); |
|
44 | 44 | BarChartModel& model(); |
|
45 | bool separatorsVisible(); | |
|
46 | 45 | // <--- TO PIMPL |
|
47 | 46 | |
|
48 | 47 | signals: |
@@ -52,13 +51,11 signals: | |||
|
52 | 51 | |
|
53 | 52 | // TODO: internal signals, these to private implementation. |
|
54 | 53 | // TODO: TO PIMPL ---> |
|
55 | void enableSeparators(bool enable); | |
|
56 | 54 | void showToolTip(QPoint pos, QString tip); |
|
57 | 55 | // <--- TO PIMPL |
|
58 | 56 | |
|
59 | 57 | public Q_SLOTS: |
|
60 | 58 | void setToolTipEnabled(bool enabled=true); // enables tooltips |
|
61 | void setSeparatorsVisible(bool visible=true); // enables separators between categories | |
|
62 | 59 | |
|
63 | 60 | // TODO: TO PIMPL ---> |
|
64 | 61 | void barsetClicked(QString category); |
@@ -74,7 +71,6 private Q_SLOTS: | |||
|
74 | 71 | |
|
75 | 72 | protected: |
|
76 | 73 | BarChartModel* mModel; |
|
77 | bool mSeparatorsVisible; | |
|
78 | 74 | |
|
79 | 75 | QAbstractItemModel* m_model; |
|
80 | 76 | int m_mapCategories; |
@@ -1,7 +1,6 | |||
|
1 | 1 | #include "stackedbarpresenter_p.h" |
|
2 | 2 | #include "bar_p.h" |
|
3 | 3 | #include "barvalue_p.h" |
|
4 | #include "separator_p.h" | |
|
5 | 4 | #include "qbarset.h" |
|
6 | 5 | #include <QDebug> |
|
7 | 6 | |
@@ -64,16 +63,7 void StackedBarPresenter::layoutChanged() | |||
|
64 | 63 | } |
|
65 | 64 | xPos += xStep; |
|
66 | 65 | } |
|
67 | /* | |
|
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 | */ | |
|
66 | ||
|
77 | 67 | // Position floating values |
|
78 | 68 | itemIndex = 0; |
|
79 | 69 | xPos = (tW/tC); |
@@ -268,7 +268,6 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS | |||
|
268 | 268 | // TODO: new implementation of setFloatingValuesEnabled with signals |
|
269 | 269 | //series->setFloatingValuesEnabled(true); |
|
270 | 270 | series->setToolTipEnabled(true); |
|
271 | series->setSeparatorsVisible(false); | |
|
272 | 271 | m_chartView->addSeries(series); |
|
273 | 272 | } else if (seriesName == "Spline") { |
|
274 | 273 | for (int j(0); j < data.count(); j ++) { |
General Comments 0
You need to be logged in to leave comments.
Login now