##// END OF EJS Templates
Bugfix area chart not drawn after drawLine change in lineseries
Michal Klocek -
r1827:f8179c45a147
parent child
Show More
@@ -1,76 +1,76
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 // W A R N I N G
21 // W A R N I N G
22 // -------------
22 // -------------
23 //
23 //
24 // This file is not part of the QtCommercial Chart API. It exists purely as an
24 // This file is not part of the QtCommercial Chart API. It exists purely as an
25 // implementation detail. This header file may change from version to
25 // implementation detail. This header file may change from version to
26 // version without notice, or even be removed.
26 // version without notice, or even be removed.
27 //
27 //
28 // We mean it.
28 // We mean it.
29
29
30 #ifndef LINECHARTITEM_H
30 #ifndef LINECHARTITEM_H
31 #define LINECHARTITEM_H
31 #define LINECHARTITEM_H
32
32
33 #include "qchartglobal.h"
33 #include "qchartglobal.h"
34 #include "xychart_p.h"
34 #include "xychart_p.h"
35 #include <QPen>
35 #include <QPen>
36
36
37 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37 QTCOMMERCIALCHART_BEGIN_NAMESPACE
38
38
39 class QLineSeries;
39 class QLineSeries;
40 class ChartPresenter;
40 class ChartPresenter;
41
41
42 class LineChartItem : public XYChart , public QGraphicsItem
42 class LineChartItem : public XYChart , public QGraphicsItem
43 {
43 {
44 Q_OBJECT
44 Q_OBJECT
45 Q_INTERFACES(QGraphicsItem)
45 Q_INTERFACES(QGraphicsItem)
46 public:
46 public:
47 explicit LineChartItem(QLineSeries *series,ChartPresenter *presenter);
47 explicit LineChartItem(QLineSeries *series,ChartPresenter *presenter);
48 ~LineChartItem() {}
48 ~LineChartItem() {}
49
49
50 //from QGraphicsItem
50 //from QGraphicsItem
51 QRectF boundingRect() const;
51 QRectF boundingRect() const;
52 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
52 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
53 QPainterPath shape() const;
53 QPainterPath shape() const;
54
54
55 QPainterPath path() const { return m_path; }
55 QPainterPath path() const { return m_linePath; }
56
56
57 public Q_SLOTS:
57 public Q_SLOTS:
58 void handleUpdated();
58 void handleUpdated();
59
59
60 protected:
60 protected:
61 void updateGeometry();
61 void updateGeometry();
62 void mousePressEvent(QGraphicsSceneMouseEvent *event);
62 void mousePressEvent(QGraphicsSceneMouseEvent *event);
63
63
64 private:
64 private:
65 QLineSeries* m_series;
65 QLineSeries* m_series;
66 QPainterPath m_path;
66 QPainterPath m_path;
67 QPainterPath m_linePath;
67 QPainterPath m_linePath;
68 QVector<QPointF> m_points;
68 QVector<QPointF> m_points;
69 QRectF m_rect;
69 QRectF m_rect;
70 QPen m_linePen;
70 QPen m_linePen;
71 bool m_pointsVisible;
71 bool m_pointsVisible;
72 };
72 };
73
73
74 QTCOMMERCIALCHART_END_NAMESPACE
74 QTCOMMERCIALCHART_END_NAMESPACE
75
75
76 #endif
76 #endif
General Comments 0
You need to be logged in to leave comments. Login now