@@ -1,5 +1,6 | |||||
1 | #include "axisitem_p.h" |
|
1 | #include "axisitem_p.h" | |
2 | #include "qchartaxis.h" |
|
2 | #include "qchartaxis.h" | |
|
3 | #include "chartpresenter_p.h" | |||
3 | #include <QPainter> |
|
4 | #include <QPainter> | |
4 | #include <QDebug> |
|
5 | #include <QDebug> | |
5 |
|
6 | |||
@@ -14,11 +15,12 m_labelsAngle(0), | |||||
14 | m_shadesEnabled(true), |
|
15 | m_shadesEnabled(true), | |
15 | m_grid(parent), |
|
16 | m_grid(parent), | |
16 | m_shades(parent), |
|
17 | m_shades(parent), | |
17 | m_labels(parent) |
|
18 | m_labels(parent), | |
|
19 | m_origin(0,0) | |||
18 | { |
|
20 | { | |
19 | //initial initialization |
|
21 | //initial initialization | |
20 |
m_shades.setZValue( |
|
22 | m_shades.setZValue(ChartPresenter::ShadesZValue); | |
21 |
m_grid.setZValue( |
|
23 | m_grid.setZValue(ChartPresenter::GridZValue); | |
22 | } |
|
24 | } | |
23 |
|
25 | |||
24 | AxisItem::~AxisItem() |
|
26 | AxisItem::~AxisItem() | |
@@ -209,7 +211,6 void AxisItem::setGridOpacity(qreal opacity) | |||||
209 | m_grid.setOpacity(opacity); |
|
211 | m_grid.setOpacity(opacity); | |
210 | } |
|
212 | } | |
211 |
|
213 | |||
212 |
|
||||
213 | qreal AxisItem::gridOpacity() const |
|
214 | qreal AxisItem::gridOpacity() const | |
214 | { |
|
215 | { | |
215 | return m_grid.opacity(); |
|
216 | return m_grid.opacity(); |
@@ -50,9 +50,9 public: | |||||
50 | void setLabelsFont(const QFont& font); |
|
50 | void setLabelsFont(const QFont& font); | |
51 |
|
51 | |||
52 | public slots: |
|
52 | public slots: | |
53 | void handleAxisUpdate(QChartAxis* axis); |
|
53 | void handleAxisUpdate(QChartAxis* axis); //look and feel | |
54 | void handleLabelsChanged(QChartAxis* axis,const QStringList& labels); |
|
54 | void handleLabelsChanged(QChartAxis* axis,const QStringList& labels); //labels from dataset | |
55 | void handleGeometryChanged(const QRectF& size); |
|
55 | void handleGeometryChanged(const QRectF& size); // geometry from presenter | |
56 | protected: |
|
56 | protected: | |
57 | void updateItem(int count); |
|
57 | void updateItem(int count); | |
58 | private: |
|
58 | private: | |
@@ -68,6 +68,7 private: | |||||
68 | QGraphicsItemGroup m_labels; |
|
68 | QGraphicsItemGroup m_labels; | |
69 | QGraphicsLineItem m_axis; |
|
69 | QGraphicsLineItem m_axis; | |
70 | QStringList m_thicksList; |
|
70 | QStringList m_thicksList; | |
|
71 | QPointF m_origin; | |||
71 |
|
72 | |||
72 | }; |
|
73 | }; | |
73 |
|
74 |
@@ -20,6 +20,8 class ChartPresenter: public QObject | |||||
20 | { |
|
20 | { | |
21 | Q_OBJECT |
|
21 | Q_OBJECT | |
22 | public: |
|
22 | public: | |
|
23 | enum ZValues { BackgroundZValue = -1 , ShadesZValue, GridZValue, AxisZValue , LineChartZValue }; | |||
|
24 | ||||
23 | ChartPresenter(QChart* chart,ChartDataSet *dataset); |
|
25 | ChartPresenter(QChart* chart,ChartDataSet *dataset); | |
24 | virtual ~ChartPresenter(); |
|
26 | virtual ~ChartPresenter(); | |
25 |
|
27 |
@@ -15,7 +15,7 m_dirtyData(false), | |||||
15 | m_dirtyGeometry(false), |
|
15 | m_dirtyGeometry(false), | |
16 | m_dirtyDomain(false) |
|
16 | m_dirtyDomain(false) | |
17 | { |
|
17 | { | |
18 |
|
18 | setZValue(ChartPresenter::LineChartZValue); | ||
19 | } |
|
19 | } | |
20 |
|
20 | |||
21 | QRectF LineChartItem::boundingRect() const |
|
21 | QRectF LineChartItem::boundingRect() const |
@@ -63,13 +63,16 void QChart::createChartBackgroundItem() | |||||
63 | { |
|
63 | { | |
64 | if(!m_backgroundItem) { |
|
64 | if(!m_backgroundItem) { | |
65 | m_backgroundItem = new QGraphicsRectItem(this); |
|
65 | m_backgroundItem = new QGraphicsRectItem(this); | |
66 |
m_backgroundItem->setZValue( |
|
66 | m_backgroundItem->setZValue(ChartPresenter::BackgroundZValue); | |
67 | } |
|
67 | } | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 | void QChart::createChartTitleItem() |
|
70 | void QChart::createChartTitleItem() | |
71 | { |
|
71 | { | |
72 | if(!m_titleItem) m_titleItem = new QGraphicsTextItem(this); |
|
72 | if(!m_titleItem) { | |
|
73 | m_titleItem = new QGraphicsTextItem(this); | |||
|
74 | m_titleItem->setZValue(ChartPresenter::BackgroundZValue); | |||
|
75 | } | |||
73 | } |
|
76 | } | |
74 |
|
77 | |||
75 | int QChart::margin() const |
|
78 | int QChart::margin() const |
General Comments 0
You need to be logged in to leave comments.
Login now