##// END OF EJS Templates
Change includes in public headers from #include "xxx" -> #include <xxx>
Jani Honkonen -
r697:fbb57e02c5e2
parent child
Show More
@@ -1,53 +1,53
1 #ifndef QAREASERIES_H_
1 #ifndef QAREASERIES_H_
2 #define QAREASERIES_H_
2 #define QAREASERIES_H_
3
3
4 #include "qchartglobal.h"
4 #include <qchartglobal.h>
5 #include "qseries.h"
5 #include <qseries.h>
6 #include <QDebug>
6 #include <QDebug>
7 #include <QPen>
7 #include <QPen>
8 #include <QBrush>
8 #include <QBrush>
9
9
10 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 QTCOMMERCIALCHART_BEGIN_NAMESPACE
11 class QLineSeries;
11 class QLineSeries;
12
12
13 class QTCOMMERCIALCHART_EXPORT QAreaSeries : public QSeries
13 class QTCOMMERCIALCHART_EXPORT QAreaSeries : public QSeries
14 {
14 {
15 Q_OBJECT
15 Q_OBJECT
16 public:
16 public:
17 QAreaSeries(QLineSeries* upperSeries,QLineSeries* lowerSeries=0);
17 QAreaSeries(QLineSeries* upperSeries,QLineSeries* lowerSeries=0);
18 virtual ~QAreaSeries();
18 virtual ~QAreaSeries();
19
19
20 public: // from QChartSeries
20 public: // from QChartSeries
21 virtual QSeriesType type() const { return QSeries::SeriesTypeArea;}
21 virtual QSeriesType type() const { return QSeries::SeriesTypeArea;}
22
22
23 QLineSeries* upperSeries() const { return m_upperSeries;}
23 QLineSeries* upperSeries() const { return m_upperSeries;}
24 QLineSeries* lowerSeries() const { return m_lowerSeries;}
24 QLineSeries* lowerSeries() const { return m_lowerSeries;}
25
25
26 void setPen(const QPen& pen);
26 void setPen(const QPen& pen);
27 QPen pen() const { return m_pen;}
27 QPen pen() const { return m_pen;}
28
28
29 void setBrush(const QBrush& brush);
29 void setBrush(const QBrush& brush);
30 QBrush brush() const { return m_brush;}
30 QBrush brush() const { return m_brush;}
31
31
32 void setPointsVisible(bool visible);
32 void setPointsVisible(bool visible);
33 bool pointsVisible() const {return m_pointsVisible;}
33 bool pointsVisible() const {return m_pointsVisible;}
34
34
35 // bool setModel(QAbstractItemModel* model);
35 // bool setModel(QAbstractItemModel* model);
36 // void setModelMappingUpper(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical);
36 // void setModelMappingUpper(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical);
37 // void setModelMappingLower(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical);
37 // void setModelMappingLower(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical);
38
38
39 signals:
39 signals:
40 void updated();
40 void updated();
41 void clicked(const QPointF& point);
41 void clicked(const QPointF& point);
42
42
43 private:
43 private:
44 QBrush m_brush;
44 QBrush m_brush;
45 QPen m_pen;
45 QPen m_pen;
46 QLineSeries* m_upperSeries;
46 QLineSeries* m_upperSeries;
47 QLineSeries* m_lowerSeries;
47 QLineSeries* m_lowerSeries;
48 bool m_pointsVisible;
48 bool m_pointsVisible;
49 };
49 };
50
50
51 QTCOMMERCIALCHART_END_NAMESPACE
51 QTCOMMERCIALCHART_END_NAMESPACE
52
52
53 #endif
53 #endif
@@ -1,114 +1,114
1 #ifndef QCHARTAXIS_H_
1 #ifndef QCHARTAXIS_H_
2 #define QCHARTAXIS_H_
2 #define QCHARTAXIS_H_
3
3
4 #include "qchartglobal.h"
4 #include <qchartglobal.h>
5 #include "qchartaxiscategories.h"
5 #include <qchartaxiscategories.h>
6 #include <QPen>
6 #include <QPen>
7 #include <QFont>
7 #include <QFont>
8
8
9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10
10
11 class QTCOMMERCIALCHART_EXPORT QChartAxis : public QObject
11 class QTCOMMERCIALCHART_EXPORT QChartAxis : public QObject
12 {
12 {
13 Q_OBJECT
13 Q_OBJECT
14 public:
14 public:
15
15
16 QChartAxis(QObject* parent =0);
16 QChartAxis(QObject* parent =0);
17 ~QChartAxis();
17 ~QChartAxis();
18
18
19 //axis handling
19 //axis handling
20 bool isAxisVisible() const { return m_axisVisible;};
20 bool isAxisVisible() const { return m_axisVisible;};
21 void setAxisVisible(bool visible);
21 void setAxisVisible(bool visible);
22 void setAxisPen(const QPen& pen);
22 void setAxisPen(const QPen& pen);
23 QPen axisPen() const { return m_axisPen;};
23 QPen axisPen() const { return m_axisPen;};
24
24
25 //grid handling
25 //grid handling
26 bool isGridLineVisible() const { return m_gridLineVisible;};
26 bool isGridLineVisible() const { return m_gridLineVisible;};
27 void setGridLineVisible(bool visible);
27 void setGridLineVisible(bool visible);
28 void setGridLinePen(const QPen& pen);
28 void setGridLinePen(const QPen& pen);
29 QPen gridLinePen() const {return m_gridLinePen;}
29 QPen gridLinePen() const {return m_gridLinePen;}
30
30
31 //labels handling
31 //labels handling
32 bool labelsVisible() const { return m_labelsVisible;};
32 bool labelsVisible() const { return m_labelsVisible;};
33 void setLabelsVisible(bool visible);
33 void setLabelsVisible(bool visible);
34 void setLabelsPen(const QPen& pen);
34 void setLabelsPen(const QPen& pen);
35 QPen labelsPen() const { return m_labelsPen;}
35 QPen labelsPen() const { return m_labelsPen;}
36 void setLabelsBrush(const QBrush& brush);
36 void setLabelsBrush(const QBrush& brush);
37 QBrush labelsBrush() const { return m_labelsBrush;}
37 QBrush labelsBrush() const { return m_labelsBrush;}
38 void setLabelsFont(const QFont& font);
38 void setLabelsFont(const QFont& font);
39 QFont labelsFont() const { return m_labelsFont;}
39 QFont labelsFont() const { return m_labelsFont;}
40 void setLabelsAngle(int angle);
40 void setLabelsAngle(int angle);
41 int labelsAngle() const { return m_labelsAngle;};
41 int labelsAngle() const { return m_labelsAngle;};
42
42
43 //shades handling
43 //shades handling
44 bool shadesVisible() const { return m_shadesVisible;};
44 bool shadesVisible() const { return m_shadesVisible;};
45 void setShadesVisible(bool visible);
45 void setShadesVisible(bool visible);
46 void setShadesPen(const QPen& pen);
46 void setShadesPen(const QPen& pen);
47 QPen shadesPen() const { return m_shadesPen;}
47 QPen shadesPen() const { return m_shadesPen;}
48 void setShadesBrush(const QBrush& brush);
48 void setShadesBrush(const QBrush& brush);
49 QBrush shadesBrush() const { return m_shadesBrush;}
49 QBrush shadesBrush() const { return m_shadesBrush;}
50 void setShadesOpacity(qreal opacity);
50 void setShadesOpacity(qreal opacity);
51 qreal shadesOpacity() const { return m_shadesOpacity;}
51 qreal shadesOpacity() const { return m_shadesOpacity;}
52
52
53 //range handling
53 //range handling
54 void setMin(qreal min);
54 void setMin(qreal min);
55 qreal min() const { return m_min;};
55 qreal min() const { return m_min;};
56 void setMax(qreal max);
56 void setMax(qreal max);
57 qreal max() const { return m_max;};
57 qreal max() const { return m_max;};
58 void setRange(qreal min, qreal max);
58 void setRange(qreal min, qreal max);
59
59
60 //ticks handling
60 //ticks handling
61 void setTicksCount(int count);
61 void setTicksCount(int count);
62 int ticksCount() const { return m_ticksCount;}
62 int ticksCount() const { return m_ticksCount;}
63
63
64 void setNiceNumbers(bool enabled);
64 void setNiceNumbers(bool enabled);
65 bool niceNumbers() const { return m_niceNumbers;}
65 bool niceNumbers() const { return m_niceNumbers;}
66
66
67 QChartAxisCategories* categories() { return &m_category; }
67 QChartAxisCategories* categories() { return &m_category; }
68
68
69 void show();
69 void show();
70 void hide();
70 void hide();
71
71
72 signals:
72 signals:
73 void minChanged(qreal min);
73 void minChanged(qreal min);
74 void maxChanged(qreal max);
74 void maxChanged(qreal max);
75 void rangeChanged(qreal min, qreal max);
75 void rangeChanged(qreal min, qreal max);
76 void ticksCountChanged(int count);
76 void ticksCountChanged(int count);
77
77
78 //interal signal
78 //interal signal
79 void updated();
79 void updated();
80 void changed(qreal min, qreal max, int tickCount,bool niceNumbers);
80 void changed(qreal min, qreal max, int tickCount,bool niceNumbers);
81 //internal slot
81 //internal slot
82 public slots:
82 public slots:
83 void handleAxisRangeChanged(qreal min, qreal max,int count);
83 void handleAxisRangeChanged(qreal min, qreal max,int count);
84
84
85 private:
85 private:
86 bool m_axisVisible;
86 bool m_axisVisible;
87 QPen m_axisPen;
87 QPen m_axisPen;
88 QBrush m_axisBrush;
88 QBrush m_axisBrush;
89
89
90 bool m_gridLineVisible;
90 bool m_gridLineVisible;
91 QPen m_gridLinePen;
91 QPen m_gridLinePen;
92
92
93 bool m_labelsVisible;
93 bool m_labelsVisible;
94 QPen m_labelsPen;
94 QPen m_labelsPen;
95 QBrush m_labelsBrush;
95 QBrush m_labelsBrush;
96 QFont m_labelsFont;
96 QFont m_labelsFont;
97 int m_labelsAngle;
97 int m_labelsAngle;
98
98
99 bool m_shadesVisible;
99 bool m_shadesVisible;
100 QPen m_shadesPen;
100 QPen m_shadesPen;
101 QBrush m_shadesBrush;
101 QBrush m_shadesBrush;
102 qreal m_shadesOpacity;
102 qreal m_shadesOpacity;
103
103
104 qreal m_min;
104 qreal m_min;
105 qreal m_max;
105 qreal m_max;
106
106
107 int m_ticksCount;
107 int m_ticksCount;
108 QChartAxisCategories m_category;
108 QChartAxisCategories m_category;
109
109
110 bool m_niceNumbers;
110 bool m_niceNumbers;
111 };
111 };
112
112
113 QTCOMMERCIALCHART_END_NAMESPACE
113 QTCOMMERCIALCHART_END_NAMESPACE
114 #endif /* QCHARTAXIS_H_ */
114 #endif /* QCHARTAXIS_H_ */
@@ -1,34 +1,34
1 #ifndef QCHARTAXISCATEGORIES_H_
1 #ifndef QCHARTAXISCATEGORIES_H_
2 #define QCHARTAXISCATEGORIES_H_
2 #define QCHARTAXISCATEGORIES_H_
3 #include "qchartglobal.h"
3 #include <qchartglobal.h>
4
4
5 QTCOMMERCIALCHART_BEGIN_NAMESPACE
5 QTCOMMERCIALCHART_BEGIN_NAMESPACE
6
6
7 class QTCOMMERCIALCHART_EXPORT QChartAxisCategories : public QObject
7 class QTCOMMERCIALCHART_EXPORT QChartAxisCategories : public QObject
8 {
8 {
9 Q_OBJECT
9 Q_OBJECT
10 private:
10 private:
11 QChartAxisCategories();
11 QChartAxisCategories();
12 public:
12 public:
13 ~QChartAxisCategories();
13 ~QChartAxisCategories();
14
14
15 void insert(qreal value,QString label);
15 void insert(qreal value,QString label);
16 void remove(qreal value);
16 void remove(qreal value);
17 QString label(qreal value) const;
17 QString label(qreal value) const;
18 void clear();
18 void clear();
19 int count();
19 int count();
20
20
21 //internal signal
21 //internal signal
22 signals:
22 signals:
23 void updated();
23 void updated();
24
24
25 private:
25 private:
26 QMap<qreal,QString> m_map;
26 QMap<qreal,QString> m_map;
27
27
28 friend class QChartAxis;
28 friend class QChartAxis;
29 };
29 };
30
30
31
31
32 QTCOMMERCIALCHART_END_NAMESPACE
32 QTCOMMERCIALCHART_END_NAMESPACE
33
33
34 #endif /* QCHARTAXISCATEGORIES_H_ */
34 #endif /* QCHARTAXISCATEGORIES_H_ */
@@ -1,91 +1,91
1 #ifndef BARSERIES_H
1 #ifndef BARSERIES_H
2 #define BARSERIES_H
2 #define BARSERIES_H
3
3
4 #include "qseries.h"
4 #include <qseries.h>
5 #include <QStringList>
5 #include <QStringList>
6
6
7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8
8
9 class QBarSet;
9 class QBarSet;
10 class BarChartModel;
10 class BarChartModel;
11 class BarCategory;
11 class BarCategory;
12
12
13 // Container for series
13 // Container for series
14 class QTCOMMERCIALCHART_EXPORT QBarSeries : public QSeries
14 class QTCOMMERCIALCHART_EXPORT QBarSeries : public QSeries
15 {
15 {
16 Q_OBJECT
16 Q_OBJECT
17 public:
17 public:
18 QBarSeries(QStringList categories, QObject* parent=0);
18 QBarSeries(QStringList categories, QObject* parent=0);
19
19
20 virtual QSeriesType type() const { return QSeries::SeriesTypeBar; }
20 virtual QSeriesType type() const { return QSeries::SeriesTypeBar; }
21
21
22 void addBarSet(QBarSet *set); // Takes ownership of set
22 void addBarSet(QBarSet *set); // Takes ownership of set
23 void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set
23 void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set
24 void insertBarSet(int i, QBarSet *set);
24 void insertBarSet(int i, QBarSet *set);
25 void insertCategory(int i, QString category);
25 void insertCategory(int i, QString category);
26 void removeCategory(int i);
26 void removeCategory(int i);
27 int barsetCount();
27 int barsetCount();
28 int categoryCount();
28 int categoryCount();
29 QList<QBarSet*> barSets();
29 QList<QBarSet*> barSets();
30
30
31 bool setModel(QAbstractItemModel* model);
31 bool setModel(QAbstractItemModel* model);
32 QAbstractItemModel* modelExt() {return m_model;}
32 QAbstractItemModel* modelExt() {return m_model;}
33 void setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation = Qt::Vertical);
33 void setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation = Qt::Vertical);
34
34
35 public:
35 public:
36 // TODO: Functions below this are not part of api and will be moved
36 // TODO: Functions below this are not part of api and will be moved
37 // to private implementation, when we start using it
37 // to private implementation, when we start using it
38 // TODO: TO PIMPL --->
38 // TODO: TO PIMPL --->
39 QBarSet* barsetAt(int index);
39 QBarSet* barsetAt(int index);
40 QString categoryName(int category);
40 QString categoryName(int category);
41 qreal min();
41 qreal min();
42 qreal max();
42 qreal max();
43 qreal valueAt(int set, int category);
43 qreal valueAt(int set, int category);
44 qreal percentageAt(int set, int category);
44 qreal percentageAt(int set, int category);
45 qreal categorySum(int category);
45 qreal categorySum(int category);
46 qreal maxCategorySum();
46 qreal maxCategorySum();
47 BarChartModel& model();
47 BarChartModel& model();
48 // <--- TO PIMPL
48 // <--- TO PIMPL
49
49
50 signals:
50 signals:
51 //void changed(int index);
51 //void changed(int index);
52 void clicked(QBarSet* barset, QString category); // Up to user of api, what to do with these signals
52 void clicked(QBarSet* barset, QString category); // Up to user of api, what to do with these signals
53 void rightClicked(QBarSet* barset, QString category);
53 void rightClicked(QBarSet* barset, QString category);
54
54
55 //
55 //
56 void updatedBars();
56 void updatedBars();
57 void restructuredBar(int);
57 void restructuredBar(int);
58
58
59 // TODO: internal signals, these to private implementation.
59 // TODO: internal signals, these to private implementation.
60 // TODO: TO PIMPL --->
60 // TODO: TO PIMPL --->
61 void showToolTip(QPoint pos, QString tip);
61 void showToolTip(QPoint pos, QString tip);
62 // <--- TO PIMPL
62 // <--- TO PIMPL
63
63
64 public Q_SLOTS:
64 public Q_SLOTS:
65 void setToolTipEnabled(bool enabled=true); // enables tooltips
65 void setToolTipEnabled(bool enabled=true); // enables tooltips
66
66
67 // TODO: TO PIMPL --->
67 // TODO: TO PIMPL --->
68 void barsetClicked(QString category);
68 void barsetClicked(QString category);
69 void barsetRightClicked(QString category);
69 void barsetRightClicked(QString category);
70 // <--- TO PIMPL
70 // <--- TO PIMPL
71
71
72 private Q_SLOTS:
72 private Q_SLOTS:
73 // slots for updating bars when data in model changes
73 // slots for updating bars when data in model changes
74 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
74 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
75 void modelDataAdded(QModelIndex parent, int start, int end);
75 void modelDataAdded(QModelIndex parent, int start, int end);
76 void modelDataRemoved(QModelIndex parent, int start, int end);
76 void modelDataRemoved(QModelIndex parent, int start, int end);
77 void barsetChanged();
77 void barsetChanged();
78
78
79 protected:
79 protected:
80 BarChartModel* mModel;
80 BarChartModel* mModel;
81
81
82 // QAbstractItemModel* m_model;
82 // QAbstractItemModel* m_model;
83 int m_mapCategories;
83 int m_mapCategories;
84 int m_mapBarBottom;
84 int m_mapBarBottom;
85 int m_mapBarTop;
85 int m_mapBarTop;
86 Qt::Orientation m_mapOrientation;
86 Qt::Orientation m_mapOrientation;
87 };
87 };
88
88
89 QTCOMMERCIALCHART_END_NAMESPACE
89 QTCOMMERCIALCHART_END_NAMESPACE
90
90
91 #endif // BARSERIES_H
91 #endif // BARSERIES_H
@@ -1,21 +1,21
1 #ifndef PERCENTBARSERIES_H
1 #ifndef PERCENTBARSERIES_H
2 #define PERCENTBARSERIES_H
2 #define PERCENTBARSERIES_H
3
3
4 #include <QStringList>
4 #include <QStringList>
5 #include "qbarseries.h"
5 #include <qbarseries.h>
6
6
7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8
8
9 class QTCOMMERCIALCHART_EXPORT QPercentBarSeries : public QBarSeries
9 class QTCOMMERCIALCHART_EXPORT QPercentBarSeries : public QBarSeries
10 {
10 {
11 Q_OBJECT
11 Q_OBJECT
12 public:
12 public:
13 QPercentBarSeries(QStringList categories, QObject* parent=0);
13 QPercentBarSeries(QStringList categories, QObject* parent=0);
14
14
15 virtual QSeriesType type() const { return QSeries::SeriesTypePercentBar; }
15 virtual QSeriesType type() const { return QSeries::SeriesTypePercentBar; }
16 };
16 };
17
17
18 QTCOMMERCIALCHART_END_NAMESPACE
18 QTCOMMERCIALCHART_END_NAMESPACE
19
19
20
20
21 #endif // PERCENTBARSERIES_H
21 #endif // PERCENTBARSERIES_H
@@ -1,20 +1,20
1 #ifndef STACKEDBARSERIES_H
1 #ifndef STACKEDBARSERIES_H
2 #define STACKEDBARSERIES_H
2 #define STACKEDBARSERIES_H
3
3
4 #include <QStringList>
4 #include <QStringList>
5 #include "qbarseries.h"
5 #include <qbarseries.h>
6
6
7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8
8
9 class QTCOMMERCIALCHART_EXPORT QStackedBarSeries : public QBarSeries
9 class QTCOMMERCIALCHART_EXPORT QStackedBarSeries : public QBarSeries
10 {
10 {
11 Q_OBJECT
11 Q_OBJECT
12 public:
12 public:
13 QStackedBarSeries(QStringList categories, QObject* parent=0);
13 QStackedBarSeries(QStringList categories, QObject* parent=0);
14
14
15 virtual QSeriesType type() const { return QSeries::SeriesTypeStackedBar; }
15 virtual QSeriesType type() const { return QSeries::SeriesTypeStackedBar; }
16 };
16 };
17
17
18 QTCOMMERCIALCHART_END_NAMESPACE
18 QTCOMMERCIALCHART_END_NAMESPACE
19
19
20 #endif // STACKEDBARSERIES_H
20 #endif // STACKEDBARSERIES_H
@@ -1,35 +1,35
1 #ifndef QLINESERIES_H_
1 #ifndef QLINESERIES_H_
2 #define QLINESERIES_H_
2 #define QLINESERIES_H_
3
3
4 #include "qchartglobal.h"
4 #include <qchartglobal.h>
5 #include "qxyseries.h"
5 #include <qxyseries.h>
6 #include <QDebug>
6 #include <QDebug>
7 #include <QPen>
7 #include <QPen>
8 #include <QBrush>
8 #include <QBrush>
9
9
10 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 QTCOMMERCIALCHART_BEGIN_NAMESPACE
11
11
12 class QTCOMMERCIALCHART_EXPORT QLineSeries : public QXYSeries
12 class QTCOMMERCIALCHART_EXPORT QLineSeries : public QXYSeries
13 {
13 {
14 public:
14 public:
15 QLineSeries(QObject* parent=0);
15 QLineSeries(QObject* parent=0);
16 virtual ~QLineSeries();
16 virtual ~QLineSeries();
17
17
18 void setLinePen(const QPen& pen);
18 void setLinePen(const QPen& pen);
19 QPen linePen() const {return m_pen;}
19 QPen linePen() const {return m_pen;}
20
20
21 void setPointsVisible(bool visible);
21 void setPointsVisible(bool visible);
22 bool pointsVisible() const {return m_pointsVisible;}
22 bool pointsVisible() const {return m_pointsVisible;}
23
23
24 public: // from QChartSeries
24 public: // from QChartSeries
25 virtual QSeriesType type() const {return QSeries::SeriesTypeLine;}
25 virtual QSeriesType type() const {return QSeries::SeriesTypeLine;}
26 friend QDebug operator<< (QDebug d, const QLineSeries series);
26 friend QDebug operator<< (QDebug d, const QLineSeries series);
27 private:
27 private:
28 QPen m_pen;
28 QPen m_pen;
29 bool m_pointsVisible;
29 bool m_pointsVisible;
30
30
31 };
31 };
32
32
33 QTCOMMERCIALCHART_END_NAMESPACE
33 QTCOMMERCIALCHART_END_NAMESPACE
34
34
35 #endif
35 #endif
@@ -1,82 +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 <qchartaxis.h>
6 #include "qseries.h"
6 #include <qseries.h>
7 #include "qchart.h"
7 #include <qchart.h>
8 #include <QGraphicsView>
8 #include <QGraphicsView>
9
9
10 class QGraphicsScene;
10 class QGraphicsScene;
11 class QRubberBand;
11 class QRubberBand;
12
12
13 QTCOMMERCIALCHART_BEGIN_NAMESPACE
13 QTCOMMERCIALCHART_BEGIN_NAMESPACE
14
14
15 class QChart;
15 class QChart;
16
16
17 class QTCOMMERCIALCHART_EXPORT QChartView : public QGraphicsView
17 class QTCOMMERCIALCHART_EXPORT QChartView : public QGraphicsView
18 {
18 {
19 Q_OBJECT
19 Q_OBJECT
20
20
21 public:
21 public:
22 enum RubberBandPolicy { NoRubberBand, VerticalRubberBand, HorizonalRubberBand, RectangleRubberBand };
22 enum RubberBandPolicy { NoRubberBand, VerticalRubberBand, HorizonalRubberBand, RectangleRubberBand };
23
23
24 explicit QChartView(QWidget *parent = 0);
24 explicit QChartView(QWidget *parent = 0);
25 ~QChartView();
25 ~QChartView();
26
26
27 //implement from QWidget
27 //implement from QWidget
28 void resizeEvent(QResizeEvent *event);
28 void resizeEvent(QResizeEvent *event);
29
29
30 void addSeries(QSeries* series,QChartAxis* axisY=0);// takes series ownership , takes axis ownership
30 void addSeries(QSeries* series,QChartAxis* axisY=0);// takes series ownership , takes axis ownership
31 void removeSeries(QSeries* series); //returns ownership , deletes axis if no series attached
31 void removeSeries(QSeries* series); //returns ownership , deletes axis if no series attached
32 void removeAllSeries(); // deletes series and axis
32 void removeAllSeries(); // deletes series and axis
33
33
34 void setChartTitle(const QString& title);
34 void setChartTitle(const QString& title);
35 QString chartTitle() const;
35 QString chartTitle() const;
36 void setChartTitleFont(const QFont& font);
36 void setChartTitleFont(const QFont& font);
37 void setChartTitleBrush(const QBrush &brush);
37 void setChartTitleBrush(const QBrush &brush);
38 QBrush chartTitleBrush();
38 QBrush chartTitleBrush();
39 void setChartBackgroundBrush(const QBrush& brush);
39 void setChartBackgroundBrush(const QBrush& brush);
40 void setChartBackgroundPen(const QPen& pen);
40 void setChartBackgroundPen(const QPen& pen);
41
41
42 void zoomIn();
42 void zoomIn();
43 void zoomIn(const QRect& rect);
43 void zoomIn(const QRect& rect);
44 void zoomOut();
44 void zoomOut();
45 void scrollLeft();
45 void scrollLeft();
46 void scrollRight();
46 void scrollRight();
47 void scrollUp();
47 void scrollUp();
48 void scrollDown();
48 void scrollDown();
49
49
50 void setRubberBandPolicy(const RubberBandPolicy );
50 void setRubberBandPolicy(const RubberBandPolicy );
51 RubberBandPolicy rubberBandPolicy() const;
51 RubberBandPolicy rubberBandPolicy() const;
52
52
53 void setChartTheme(QChart::ChartTheme theme);
53 void setChartTheme(QChart::ChartTheme theme);
54 QChart::ChartTheme chartTheme() const;
54 QChart::ChartTheme chartTheme() const;
55
55
56 void setAnimationOptions(QChart::AnimationOptions options);
56 void setAnimationOptions(QChart::AnimationOptions options);
57 QChart::AnimationOptions animationOptions() const;
57 QChart::AnimationOptions animationOptions() const;
58
58
59 QChartAxis* axisX() const;
59 QChartAxis* axisX() const;
60 QChartAxis* axisY() const;
60 QChartAxis* axisY() const;
61
61
62 QLegend* legend() const;
62 QLegend* legend() const;
63
63
64 protected:
64 protected:
65 void mousePressEvent(QMouseEvent *event);
65 void mousePressEvent(QMouseEvent *event);
66 void mouseMoveEvent(QMouseEvent *event);
66 void mouseMoveEvent(QMouseEvent *event);
67 void mouseReleaseEvent(QMouseEvent *event);
67 void mouseReleaseEvent(QMouseEvent *event);
68 void keyPressEvent(QKeyEvent *event);
68 void keyPressEvent(QKeyEvent *event);
69
69
70 private:
70 private:
71 QGraphicsScene *m_scene;
71 QGraphicsScene *m_scene;
72 QChart* m_chart;
72 QChart* m_chart;
73 QPoint m_rubberBandOrigin;
73 QPoint m_rubberBandOrigin;
74 QRubberBand* m_rubberBand;
74 QRubberBand* m_rubberBand;
75 bool m_verticalRubberBand;
75 bool m_verticalRubberBand;
76 bool m_horizonalRubberBand;
76 bool m_horizonalRubberBand;
77 Q_DISABLE_COPY(QChartView)
77 Q_DISABLE_COPY(QChartView)
78 };
78 };
79
79
80 QTCOMMERCIALCHART_END_NAMESPACE
80 QTCOMMERCIALCHART_END_NAMESPACE
81
81
82 #endif // QCHARTWIDGET_H
82 #endif // QCHARTWIDGET_H
@@ -1,86 +1,86
1 #ifndef QLEGEND_H
1 #ifndef QLEGEND_H
2 #define QLEGEND_H
2 #define QLEGEND_H
3
3
4 #include "qchartglobal.h"
4 #include <qchartglobal.h>
5 #include "qseries.h"
5 #include <qseries.h>
6 #include <QGraphicsObject>
6 #include <QGraphicsObject>
7
7
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
9
10 class Domain;
10 class Domain;
11 class LegendMarker;
11 class LegendMarker;
12 class QPieSlice;
12 class QPieSlice;
13 class QXYSeries;
13 class QXYSeries;
14 class QBarSet;
14 class QBarSet;
15 class QBarSeries;
15 class QBarSeries;
16 class QPieSeries;
16 class QPieSeries;
17
17
18 class QTCOMMERCIALCHART_EXPORT QLegend : public QGraphicsObject
18 class QTCOMMERCIALCHART_EXPORT QLegend : public QGraphicsObject
19 {
19 {
20 Q_OBJECT
20 Q_OBJECT
21 public:
21 public:
22
22
23 enum PreferredLayout {
23 enum PreferredLayout {
24 PreferredLayoutHorizontal,
24 PreferredLayoutHorizontal,
25 PreferredLayoutVertical
25 PreferredLayoutVertical
26 };
26 };
27
27
28 explicit QLegend(QGraphicsItem *parent = 0);
28 explicit QLegend(QGraphicsItem *parent = 0);
29
29
30 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
30 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
31 QRectF boundingRect() const;
31 QRectF boundingRect() const;
32
32
33 void setBrush(const QBrush& brush);
33 void setBrush(const QBrush& brush);
34 QBrush brush() const;
34 QBrush brush() const;
35
35
36 void setPen(const QPen& pen);
36 void setPen(const QPen& pen);
37 QPen pen() const;
37 QPen pen() const;
38
38
39 void setPreferredLayout(QLegend::PreferredLayout preferred);
39 void setPreferredLayout(QLegend::PreferredLayout preferred);
40
40
41 QSizeF maximumSize() const;
41 QSizeF maximumSize() const;
42 void setMaximumSize(const QSizeF size);
42 void setMaximumSize(const QSizeF size);
43
43
44 void setSize(const QSizeF size);
44 void setSize(const QSizeF size);
45 void setPos(const QPointF &pos);
45 void setPos(const QPointF &pos);
46
46
47 signals:
47 signals:
48 // for interactions.
48 // for interactions.
49 void clicked(QSeries* series, Qt::MouseButton button);
49 void clicked(QSeries* series, Qt::MouseButton button);
50 void clicked(QBarSet* barset, Qt::MouseButton button);
50 void clicked(QBarSet* barset, Qt::MouseButton button);
51 void clicked(QPieSlice* slice, Qt::MouseButton button);
51 void clicked(QPieSlice* slice, Qt::MouseButton button);
52
52
53 public slots:
53 public slots:
54 void handleSeriesAdded(QSeries* series,Domain* domain);
54 void handleSeriesAdded(QSeries* series,Domain* domain);
55 void handleSeriesRemoved(QSeries* series);
55 void handleSeriesRemoved(QSeries* series);
56 void handleAdded(QList<QPieSlice*> slices);
56 void handleAdded(QList<QPieSlice*> slices);
57 void handleRemoved(QList<QPieSlice*> slices);
57 void handleRemoved(QList<QPieSlice*> slices);
58 void handleMarkerDestroyed();
58 void handleMarkerDestroyed();
59
59
60 private:
60 private:
61 // PIMPL --->
61 // PIMPL --->
62 void connectSeries(QSeries* series);
62 void connectSeries(QSeries* series);
63 void disconnectSeries(QSeries* series);
63 void disconnectSeries(QSeries* series);
64 void createMarkers(QSeries* series);
64 void createMarkers(QSeries* series);
65 void appendMarkers(QXYSeries* series); // All line series are derived from QXYSeries, so this works for now
65 void appendMarkers(QXYSeries* series); // All line series are derived from QXYSeries, so this works for now
66 void appendMarkers(QBarSeries* series);
66 void appendMarkers(QBarSeries* series);
67 void appendMarkers(QPieSeries* series);
67 void appendMarkers(QPieSeries* series);
68 void deleteMarkers(QSeries* series);
68 void deleteMarkers(QSeries* series);
69 void layoutChanged();
69 void layoutChanged();
70 // <--- PIMPL
70 // <--- PIMPL
71
71
72 QPointF mPos;
72 QPointF mPos;
73 QSizeF mSize;
73 QSizeF mSize;
74 QSizeF mMinimumSize;
74 QSizeF mMinimumSize;
75 QSizeF mMaximumSize;
75 QSizeF mMaximumSize;
76
76
77 QList<LegendMarker*> mMarkers;
77 QList<LegendMarker*> mMarkers;
78
78
79 QBrush m_brush;
79 QBrush m_brush;
80 QPen m_pen;
80 QPen m_pen;
81 QLegend::PreferredLayout mPreferredLayout;
81 QLegend::PreferredLayout mPreferredLayout;
82 };
82 };
83
83
84 QTCOMMERCIALCHART_END_NAMESPACE
84 QTCOMMERCIALCHART_END_NAMESPACE
85
85
86 #endif // QLEGEND_H
86 #endif // QLEGEND_H
@@ -1,48 +1,48
1 #ifndef QSERIES_H
1 #ifndef QSERIES_H
2 #define QSERIES_H
2 #define QSERIES_H
3
3
4 #include "qchartglobal.h"
4 #include <qchartglobal.h>
5 #include <QObject>
5 #include <QObject>
6 #include <QAbstractItemModel>
6 #include <QAbstractItemModel>
7 #include <QPen>
7 #include <QPen>
8
8
9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10
10
11 class QTCOMMERCIALCHART_EXPORT QSeries : public QObject
11 class QTCOMMERCIALCHART_EXPORT QSeries : public QObject
12 {
12 {
13 Q_OBJECT
13 Q_OBJECT
14 public:
14 public:
15 enum QSeriesType {
15 enum QSeriesType {
16 SeriesTypeLine,
16 SeriesTypeLine,
17 SeriesTypeArea,
17 SeriesTypeArea,
18 SeriesTypeBar,
18 SeriesTypeBar,
19 SeriesTypeStackedBar,
19 SeriesTypeStackedBar,
20 SeriesTypePercentBar,
20 SeriesTypePercentBar,
21 SeriesTypePie,
21 SeriesTypePie,
22 SeriesTypeScatter,
22 SeriesTypeScatter,
23 SeriesTypeSpline
23 SeriesTypeSpline
24 };
24 };
25
25
26 protected:
26 protected:
27 QSeries(QObject *parent = 0) : QObject(parent) {m_model = NULL;}
27 QSeries(QObject *parent = 0) : QObject(parent) {m_model = NULL;}
28
28
29 public:
29 public:
30 virtual ~QSeries() {}
30 virtual ~QSeries() {}
31 virtual QSeriesType type() const = 0;
31 virtual QSeriesType type() const = 0;
32 QString name() { return QString("TODO: Name QSeries"); }
32 QString name() { return QString("TODO: Name QSeries"); }
33 // TODO
33 // TODO
34 virtual bool setModel(QAbstractItemModel* /*model*/) { return false; }
34 virtual bool setModel(QAbstractItemModel* /*model*/) { return false; }
35
35
36 void setTitle(QString title) { m_title = title; }
36 void setTitle(QString title) { m_title = title; }
37 QString title() { return m_title; }
37 QString title() { return m_title; }
38
38
39 protected:
39 protected:
40 QAbstractItemModel* m_model;
40 QAbstractItemModel* m_model;
41
41
42 private:
42 private:
43 QString m_title;
43 QString m_title;
44 };
44 };
45
45
46 QTCOMMERCIALCHART_END_NAMESPACE
46 QTCOMMERCIALCHART_END_NAMESPACE
47
47
48 #endif
48 #endif
@@ -1,41 +1,41
1 #ifndef QSCATTERSERIES_H
1 #ifndef QSCATTERSERIES_H
2 #define QSCATTERSERIES_H
2 #define QSCATTERSERIES_H
3
3
4 #include "qchartglobal.h"
4 #include <qchartglobal.h>
5 #include "qxyseries.h"
5 #include <qxyseries.h>
6 #include <QRectF>
6 #include <QRectF>
7 #include <QColor>
7 #include <QColor>
8
8
9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 class QScatterSeriesPrivate;
10 class QScatterSeriesPrivate;
11
11
12 class QTCOMMERCIALCHART_EXPORT QScatterSeries : public QXYSeries
12 class QTCOMMERCIALCHART_EXPORT QScatterSeries : public QXYSeries
13 {
13 {
14
14
15 public:
15 public:
16 enum MarkerShape {
16 enum MarkerShape {
17 MarkerShapeCircle,
17 MarkerShapeCircle,
18 MarkerShapeRectangle
18 MarkerShapeRectangle
19 };
19 };
20
20
21 public:
21 public:
22 QScatterSeries(QObject *parent = 0);
22 QScatterSeries(QObject *parent = 0);
23 ~QScatterSeries();
23 ~QScatterSeries();
24
24
25 public: // from QChartSeries
25 public: // from QChartSeries
26 QSeriesType type() const { return QSeries::SeriesTypeScatter; }
26 QSeriesType type() const { return QSeries::SeriesTypeScatter; }
27
27
28 public:
28 public:
29 MarkerShape shape() const;
29 MarkerShape shape() const;
30 void setShape(MarkerShape shape);
30 void setShape(MarkerShape shape);
31 qreal size() const;
31 qreal size() const;
32 void setSize(qreal size);
32 void setSize(qreal size);
33
33
34 private:
34 private:
35 MarkerShape m_shape;
35 MarkerShape m_shape;
36 qreal m_size;
36 qreal m_size;
37 };
37 };
38
38
39 QTCOMMERCIALCHART_END_NAMESPACE
39 QTCOMMERCIALCHART_END_NAMESPACE
40
40
41 #endif // QSCATTERSERIES_H
41 #endif // QSCATTERSERIES_H
@@ -1,46 +1,46
1 #ifndef QSPLINESERIES_H
1 #ifndef QSPLINESERIES_H
2 #define QSPLINESERIES_H
2 #define QSPLINESERIES_H
3
3
4 #include "qchartglobal.h"
4 #include <qchartglobal.h>
5 #include <QtGlobal>
5 #include <QtGlobal>
6 #include "qlineseries.h"
6 #include <qlineseries.h>
7 #include <QList>
7 #include <QList>
8 #include <QPointF>
8 #include <QPointF>
9
9
10 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 QTCOMMERCIALCHART_BEGIN_NAMESPACE
11
11
12 class QTCOMMERCIALCHART_EXPORT QSplineSeries : public QLineSeries
12 class QTCOMMERCIALCHART_EXPORT QSplineSeries : public QLineSeries
13 {
13 {
14 Q_OBJECT
14 Q_OBJECT
15 public:
15 public:
16
16
17 QSplineSeries(QObject *parent = 0);
17 QSplineSeries(QObject *parent = 0);
18 QSeriesType type() const {return QSeries::SeriesTypeSpline;}
18 QSeriesType type() const {return QSeries::SeriesTypeSpline;}
19
19
20 // int count() const { return m_x.size(); }
20 // int count() const { return m_x.size(); }
21 QPointF controlPoint(int index) const {return m_controlPoints[index];}
21 QPointF controlPoint(int index) const {return m_controlPoints[index];}
22 bool setModel(QAbstractItemModel* model);
22 bool setModel(QAbstractItemModel* model);
23
23
24 void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical);
24 void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical);
25
25
26 // TODO: allow the user to set custom control points
26 // TODO: allow the user to set custom control points
27 // void setCustomControlPoints(QList<QPointsF> controlPoints);
27 // void setCustomControlPoints(QList<QPointsF> controlPoints);
28 // bool calculateControlPointsAutomatically();
28 // bool calculateControlPointsAutomatically();
29 // void setCalculateControlPointsAutomatically();
29 // void setCalculateControlPointsAutomatically();
30
30
31
31
32 private:
32 private:
33 void calculateControlPoints();
33 void calculateControlPoints();
34 QList<qreal> getFirstControlPoints(QList<qreal> rhs);
34 QList<qreal> getFirstControlPoints(QList<qreal> rhs);
35
35
36 private slots:
36 private slots:
37 void updateControlPoints();
37 void updateControlPoints();
38
38
39 private:
39 private:
40 QList<QPointF> m_controlPoints;
40 QList<QPointF> m_controlPoints;
41
41
42 };
42 };
43
43
44 QTCOMMERCIALCHART_END_NAMESPACE
44 QTCOMMERCIALCHART_END_NAMESPACE
45
45
46 #endif // QSPLINESERIES_H
46 #endif // QSPLINESERIES_H
@@ -1,77 +1,77
1 #ifndef QXYSERIES_H_
1 #ifndef QXYSERIES_H_
2 #define QXYSERIES_H_
2 #define QXYSERIES_H_
3
3
4 #include "qchartglobal.h"
4 #include <qchartglobal.h>
5 #include "qseries.h"
5 #include <qseries.h>
6 #include <QDebug>
6 #include <QDebug>
7 #include <QPen>
7 #include <QPen>
8 #include <QBrush>
8 #include <QBrush>
9
9
10 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 QTCOMMERCIALCHART_BEGIN_NAMESPACE
11
11
12 class QTCOMMERCIALCHART_EXPORT QXYSeries : public QSeries
12 class QTCOMMERCIALCHART_EXPORT QXYSeries : public QSeries
13 {
13 {
14 Q_OBJECT
14 Q_OBJECT
15 protected:
15 protected:
16 QXYSeries(QObject* parent=0);
16 QXYSeries(QObject* parent=0);
17 virtual ~QXYSeries();
17 virtual ~QXYSeries();
18
18
19 public:
19 public:
20 void add(qreal x, qreal y);
20 void add(qreal x, qreal y);
21 void add(const QPointF& point);
21 void add(const QPointF& point);
22 void add(const QList<QPointF> points);
22 void add(const QList<QPointF> points);
23 void replace(qreal x,qreal y);
23 void replace(qreal x,qreal y);
24 void replace(const QPointF& point);
24 void replace(const QPointF& point);
25 void remove(qreal x);
25 void remove(qreal x);
26 void remove(qreal x, qreal y);
26 void remove(qreal x, qreal y);
27 void remove(const QPointF& point);
27 void remove(const QPointF& point);
28 void removeAll();
28 void removeAll();
29
29
30 int count() const;
30 int count() const;
31 qreal x(int pos) const;
31 qreal x(int pos) const;
32 qreal y(int pos) const;
32 qreal y(int pos) const;
33 QList<QPointF> data();
33 QList<QPointF> data();
34
34
35 QXYSeries& operator << (const QPointF &point);
35 QXYSeries& operator << (const QPointF &point);
36 QXYSeries& operator << (const QList<QPointF> points);
36 QXYSeries& operator << (const QList<QPointF> points);
37
37
38 void setPen(const QPen& pen);
38 void setPen(const QPen& pen);
39 QPen pen() const {return m_pen;}
39 QPen pen() const {return m_pen;}
40 void setBrush(const QBrush& pen);
40 void setBrush(const QBrush& pen);
41 QBrush brush() const {return m_brush;}
41 QBrush brush() const {return m_brush;}
42
42
43 bool setModel(QAbstractItemModel* model);
43 bool setModel(QAbstractItemModel* model);
44 QAbstractItemModel* model() {return m_model;}
44 QAbstractItemModel* model() {return m_model;}
45
45
46 virtual void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical);
46 virtual void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical);
47 // void setModelMappingY(int modelLineIndex, Qt::Orientation orientation = Qt::Vertical);
47 // void setModelMappingY(int modelLineIndex, Qt::Orientation orientation = Qt::Vertical);
48
48
49 private slots:
49 private slots:
50 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
50 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
51 void modelDataAdded(QModelIndex parent, int start, int end);
51 void modelDataAdded(QModelIndex parent, int start, int end);
52 void modelDataRemoved(QModelIndex parent, int start, int end);
52 void modelDataRemoved(QModelIndex parent, int start, int end);
53
53
54 signals:
54 signals:
55 void clicked(const QPointF& point);
55 void clicked(const QPointF& point);
56 void updated();
56 void updated();
57 void pointReplaced(int index);
57 void pointReplaced(int index);
58 void pointRemoved(int index);
58 void pointRemoved(int index);
59 void pointAdded(int index);
59 void pointAdded(int index);
60
60
61 protected:
61 protected:
62 QVector<qreal> m_x;
62 QVector<qreal> m_x;
63 QVector<qreal> m_y;
63 QVector<qreal> m_y;
64
64
65 QPen m_pen;
65 QPen m_pen;
66 QBrush m_brush;
66 QBrush m_brush;
67
67
68 // QAbstractItemModel* m_model;
68 // QAbstractItemModel* m_model;
69 int m_mapX;
69 int m_mapX;
70 Qt::Orientation m_mapOrientation;
70 Qt::Orientation m_mapOrientation;
71 int m_mapY;
71 int m_mapY;
72 // Qt::Orientation m_mapYOrientation;
72 // Qt::Orientation m_mapYOrientation;
73 };
73 };
74
74
75 QTCOMMERCIALCHART_END_NAMESPACE
75 QTCOMMERCIALCHART_END_NAMESPACE
76
76
77 #endif
77 #endif
General Comments 0
You need to be logged in to leave comments. Login now