@@ -1,81 +1,82 | |||||
1 | #ifndef QCHARTWIDGET_H |
|
1 | #ifndef QCHARTWIDGET_H | |
2 | #define QCHARTWIDGET_H |
|
2 | #define QCHARTWIDGET_H | |
3 |
|
3 | |||
4 | #include "qchartglobal.h" |
|
4 | #include "qchartglobal.h" | |
|
5 | #include "qchartaxis.h" | |||
5 | #include "qseries.h" |
|
6 | #include "qseries.h" | |
6 | #include "qchart.h" |
|
7 | #include "qchart.h" | |
7 | #include <QGraphicsView> |
|
8 | #include <QGraphicsView> | |
8 |
|
9 | |||
9 | class QGraphicsScene; |
|
10 | class QGraphicsScene; | |
10 | class QRubberBand; |
|
11 | class QRubberBand; | |
11 |
|
12 | |||
12 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
13 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
13 |
|
14 | |||
14 | class QChart; |
|
15 | class QChart; | |
15 |
|
16 | |||
16 | class QTCOMMERCIALCHART_EXPORT QChartView : public QGraphicsView |
|
17 | class QTCOMMERCIALCHART_EXPORT QChartView : public QGraphicsView | |
17 | { |
|
18 | { | |
18 | public: |
|
19 | public: | |
19 | enum RubberBandPolicy { NoRubberBand, VerticalRubberBand, HorizonalRubberBand, RectangleRubberBand }; |
|
20 | enum RubberBandPolicy { NoRubberBand, VerticalRubberBand, HorizonalRubberBand, RectangleRubberBand }; | |
20 |
|
21 | |||
21 | explicit QChartView(QWidget *parent = 0); |
|
22 | explicit QChartView(QWidget *parent = 0); | |
22 | ~QChartView(); |
|
23 | ~QChartView(); | |
23 |
|
24 | |||
24 | //implement from QWidget |
|
25 | //implement from QWidget | |
25 | void resizeEvent(QResizeEvent *event); |
|
26 | void resizeEvent(QResizeEvent *event); | |
26 |
|
27 | |||
27 | void addSeries(QSeries* series,QChartAxis* axisY=0);// takes series ownership , takes axis ownership |
|
28 | void addSeries(QSeries* series,QChartAxis* axisY=0);// takes series ownership , takes axis ownership | |
28 | void removeSeries(QSeries* series); //returns ownership , deletes axis if no series attached |
|
29 | void removeSeries(QSeries* series); //returns ownership , deletes axis if no series attached | |
29 | void removeAllSeries(); // deletes series and axis |
|
30 | void removeAllSeries(); // deletes series and axis | |
30 | int margin() const; |
|
31 | int margin() const; | |
31 |
|
32 | |||
32 | void setChartTitle(const QString& title); |
|
33 | void setChartTitle(const QString& title); | |
33 | QString chartTitle() const; |
|
34 | QString chartTitle() const; | |
34 | void setChartTitleFont(const QFont& font); |
|
35 | void setChartTitleFont(const QFont& font); | |
35 | void setChartTitleBrush(const QBrush &brush); |
|
36 | void setChartTitleBrush(const QBrush &brush); | |
36 | QBrush chartTitleBrush(); |
|
37 | QBrush chartTitleBrush(); | |
37 | void setChartBackgroundBrush(const QBrush& brush); |
|
38 | void setChartBackgroundBrush(const QBrush& brush); | |
38 | void setChartBackgroundPen(const QPen& pen); |
|
39 | void setChartBackgroundPen(const QPen& pen); | |
39 |
|
40 | |||
40 | void zoomIn(); |
|
41 | void zoomIn(); | |
41 | void zoomIn(const QRect& rect); |
|
42 | void zoomIn(const QRect& rect); | |
42 | void zoomOut(); |
|
43 | void zoomOut(); | |
43 |
|
44 | |||
44 | void scroll(int dx,int dy); |
|
45 | void scroll(int dx,int dy); | |
45 |
|
46 | |||
46 | void setRubberBandPolicy(const RubberBandPolicy ); |
|
47 | void setRubberBandPolicy(const RubberBandPolicy ); | |
47 | RubberBandPolicy rubberBandPolicy() const; |
|
48 | RubberBandPolicy rubberBandPolicy() const; | |
48 |
|
49 | |||
49 | void setChartTheme(QChart::ChartTheme theme); |
|
50 | void setChartTheme(QChart::ChartTheme theme); | |
50 | QChart::ChartTheme chartTheme() const; |
|
51 | QChart::ChartTheme chartTheme() const; | |
51 |
|
52 | |||
52 | void setAnimationOptions(QChart::AnimationOptions options); |
|
53 | void setAnimationOptions(QChart::AnimationOptions options); | |
53 | QChart::AnimationOptions animationOptions() const; |
|
54 | QChart::AnimationOptions animationOptions() const; | |
54 |
|
55 | |||
55 | QChartAxis* axisX() const; |
|
56 | QChartAxis* axisX() const; | |
56 | QChartAxis* axisY() const; |
|
57 | QChartAxis* axisY() const; | |
57 |
|
58 | |||
58 | QLegend* legend() const; |
|
59 | QLegend* legend() const; | |
59 |
|
60 | |||
60 | protected: |
|
61 | protected: | |
61 | void mousePressEvent(QMouseEvent *event); |
|
62 | void mousePressEvent(QMouseEvent *event); | |
62 | void mouseMoveEvent(QMouseEvent *event); |
|
63 | void mouseMoveEvent(QMouseEvent *event); | |
63 | void mouseReleaseEvent(QMouseEvent *event); |
|
64 | void mouseReleaseEvent(QMouseEvent *event); | |
64 | void keyPressEvent(QKeyEvent *event); |
|
65 | void keyPressEvent(QKeyEvent *event); | |
65 |
|
66 | |||
66 |
|
67 | |||
67 | private: |
|
68 | private: | |
68 | QGraphicsScene *m_scene; |
|
69 | QGraphicsScene *m_scene; | |
69 | QChart* m_chart; |
|
70 | QChart* m_chart; | |
70 | QPoint m_rubberBandOrigin; |
|
71 | QPoint m_rubberBandOrigin; | |
71 | QRubberBand* m_rubberBand; |
|
72 | QRubberBand* m_rubberBand; | |
72 | bool m_verticalRubberBand; |
|
73 | bool m_verticalRubberBand; | |
73 | bool m_horizonalRubberBand; |
|
74 | bool m_horizonalRubberBand; | |
74 | Q_DISABLE_COPY(QChartView) |
|
75 | Q_DISABLE_COPY(QChartView) | |
75 |
|
76 | |||
76 |
|
77 | |||
77 | }; |
|
78 | }; | |
78 |
|
79 | |||
79 | QTCOMMERCIALCHART_END_NAMESPACE |
|
80 | QTCOMMERCIALCHART_END_NAMESPACE | |
80 |
|
81 | |||
81 | #endif // QCHARTWIDGET_H |
|
82 | #endif // QCHARTWIDGET_H |
General Comments 0
You need to be logged in to leave comments.
Login now