@@ -11,7 +11,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
11 | 11 | AreaChartItem::AreaChartItem(QAreaSeries* areaSeries,QGraphicsItem *parent):ChartItem(parent), |
|
12 | 12 | m_series(areaSeries), |
|
13 | 13 | m_upper(0), |
|
14 | m_lower(0) | |
|
14 | m_lower(0), | |
|
15 | m_pointsVisible(false) | |
|
15 | 16 | { |
|
16 | 17 | //m_items.setZValue(ChartPresenter::LineChartZValue); |
|
17 | 18 | m_upper = new AreaBoundItem(this,m_series->upperSeries()); |
@@ -63,8 +64,12 void AreaChartItem::updatePath() | |||
|
63 | 64 | |
|
64 | 65 | void AreaChartItem::handleUpdated() |
|
65 | 66 | { |
|
66 |
m_p |
|
|
67 | m_pointsVisible = m_series->pointsVisible(); | |
|
68 | m_linePen = m_series->pen(); | |
|
67 | 69 | m_brush = m_series->brush(); |
|
70 | m_pointPen = m_series->pen(); | |
|
71 | m_pointPen.setWidthF(2*m_pointPen.width()); | |
|
72 | ||
|
68 | 73 | update(); |
|
69 | 74 | } |
|
70 | 75 | |
@@ -90,10 +95,15 void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt | |||
|
90 | 95 | Q_UNUSED(widget); |
|
91 | 96 | Q_UNUSED(option); |
|
92 | 97 | painter->save(); |
|
93 |
painter->setPen(m_ |
|
|
98 | painter->setPen(m_linePen); | |
|
94 | 99 | painter->setBrush(m_brush); |
|
95 | 100 | painter->setClipRect(m_clipRect); |
|
96 | 101 | painter->drawPath(m_path); |
|
102 | if(m_pointsVisible){ | |
|
103 | painter->setPen(m_pointPen); | |
|
104 | painter->drawPoints(m_upper->points()); | |
|
105 | if(m_lower) painter->drawPoints(m_lower->points()); | |
|
106 | } | |
|
97 | 107 | painter->restore(); |
|
98 | 108 | } |
|
99 | 109 |
@@ -25,7 +25,6 public: | |||
|
25 | 25 | LineChartItem* upperLineItem() const { return m_upper ;} |
|
26 | 26 | LineChartItem* lowerLineItem() const { return m_lower ;} |
|
27 | 27 | |
|
28 | void setPointsVisible(bool visible); | |
|
29 | 28 | void updatePath(); |
|
30 | 29 | public slots: |
|
31 | 30 | void handleUpdated(); |
@@ -39,8 +38,11 private: | |||
|
39 | 38 | QPainterPath m_path; |
|
40 | 39 | QRectF m_rect; |
|
41 | 40 | QRectF m_clipRect; |
|
42 |
QPen m_ |
|
|
41 | QPen m_linePen; | |
|
42 | QPen m_pointPen; | |
|
43 | 43 | QBrush m_brush; |
|
44 | bool m_pointsVisible; | |
|
45 | ||
|
44 | 46 | }; |
|
45 | 47 | |
|
46 | 48 | class AreaBoundItem : public LineChartItem |
General Comments 0
You need to be logged in to leave comments.
Login now