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