##// END OF EJS Templates
minor cleaning of unused code
sauimone -
r175:05f9f3d08ff3
parent child
Show More
@@ -1,60 +1,56
1 #ifndef BARGROUPBASE_H
1 #ifndef BARGROUPBASE_H
2 #define BARGROUPBASE_H
2 #define BARGROUPBASE_H
3
3
4 #include "chartitem_p.h"
4 #include "chartitem_p.h"
5 #include "barchartmodel_p.h"
5 #include "barchartmodel_p.h"
6 #include <QGraphicsItem>
6 #include <QGraphicsItem>
7
7
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
9
10 // Base Class for bar groups. Common implemantation of different groups. Not to be instantiated.
10 // Base Class for bar groups. Common implemantation of different groups. Not to be instantiated.
11 class BarGroupBase : public QObject, public ChartItem
11 class BarGroupBase : public QObject, public ChartItem
12 {
12 {
13 Q_OBJECT
13 Q_OBJECT
14 public:
14 public:
15 BarGroupBase(BarChartModel& model, QGraphicsItem *parent = 0);
15 BarGroupBase(BarChartModel& model, QGraphicsItem *parent = 0);
16 void setSeparatorsVisible(bool visible = true);
16 void setSeparatorsVisible(bool visible = true);
17
17
18 public: // From ChartItem
18 public:
19 // void setSize(const QSizeF &size){};
20
19
21 // From QGraphicsItem
20 // From QGraphicsItem
22 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
21 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
23 QRectF boundingRect() const;
22 QRectF boundingRect() const;
24
23
25 // TODO: these may change with layout awarness.
24 // TODO: these may change with layout awarness.
26 void setBarWidth( int w );
25 void setBarWidth( int w );
27 int addColor( QColor color );
26 int addColor( QColor color );
28 void resetColors();
27 void resetColors();
29
28
30 // TODO: Consider the domain for layoutChanged. May be use case, may not be. If it is, then the derived classes need to implement it
29 // TODO: Consider the domain for layoutChanged. May be use case, may not be. If it is, then the derived classes need to implement it
31 virtual void dataChanged(); // data of series has changed -> need to recalculate bar sizes
30 virtual void dataChanged(); // data of series has changed -> need to recalculate bar sizes
32 virtual void layoutChanged() = 0; // layout has changed -> need to recalculate bar sizes
31 virtual void layoutChanged() = 0; // layout has changed -> need to recalculate bar sizes
33
32
34 protected slots:
33 protected slots:
35 void handleModelChanged(int index);
34 void handleModelChanged(int index);
36 void handleDomainChanged(const Domain& domain);
35 void handleDomainChanged(const Domain& domain);
37 void handleGeometryChanged(const QRectF& size);
36 void handleGeometryChanged(const QRectF& size);
38
37
39 protected:
38 protected:
40
39
41 // TODO: consider these.
40 // TODO: consider these.
42 //int mMin; // Min and max values of data. (updated when data is changed, used when drawing)
43 //int mMax;
44
45 int mHeight; // Layout spesific
41 int mHeight; // Layout spesific
46 int mWidth;
42 int mWidth;
47 int mBarDefaultWidth;
43 int mBarDefaultWidth;
48
44
49 bool mLayoutSet; // True, if component has been laid out.
45 bool mLayoutSet; // True, if component has been laid out.
50 bool mLayoutDirty;
46 bool mLayoutDirty;
51
47
52 QList<QColor> mColors; // List of colors for series for now
48 QList<QColor> mColors; // List of colors for series for now
53 bool mSeparatorsVisible;
49 bool mSeparatorsVisible;
54 BarChartModel& mModel;
50 BarChartModel& mModel;
55
51
56 };
52 };
57
53
58 QTCOMMERCIALCHART_END_NAMESPACE
54 QTCOMMERCIALCHART_END_NAMESPACE
59
55
60 #endif // BARGROUPBASE_H
56 #endif // BARGROUPBASE_H
@@ -1,50 +1,45
1 #ifndef QCHARTSERIES_H
1 #ifndef QCHARTSERIES_H
2 #define QCHARTSERIES_H
2 #define QCHARTSERIES_H
3
3
4 #include "qchartglobal.h"
4 #include "qchartglobal.h"
5 #include <QObject>
5 #include <QObject>
6 #include <QAbstractItemModel>
6 #include <QAbstractItemModel>
7
7
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
9
10 class QTCOMMERCIALCHART_EXPORT QChartSeries : public QObject
10 class QTCOMMERCIALCHART_EXPORT QChartSeries : public QObject
11 {
11 {
12 Q_OBJECT
12 Q_OBJECT
13 public:
13 public:
14 enum QChartSeriesType {
14 enum QChartSeriesType {
15 SeriesTypeInvalid = -1,
15 SeriesTypeInvalid = -1,
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 QChartSeries(QObject *parent = 0):QObject(parent){};
27 QChartSeries(QObject *parent = 0):QObject(parent){};
28
28
29 public:
29 public:
30 virtual ~QChartSeries(){};
30 virtual ~QChartSeries(){};
31
31
32 // Pure virtual
32 // Pure virtual
33 virtual QChartSeriesType type() const = 0;
33 virtual QChartSeriesType type() const = 0;
34
34
35 virtual bool setData(QList<int> /*data*/) { return false; }
36 virtual bool setData(QList<qreal> /*data*/) { return false; }
35 virtual bool setData(QList<qreal> /*data*/) { return false; }
37 virtual bool setData(QList<qreal> /*x*/, QList<qreal> /*y*/){ return false; }
36 virtual bool setData(QList<qreal> /*x*/, QList<qreal> /*y*/){ return false; }
38
37
39 // Prototype for data model. TODO: remove the other setData methods and use something like this for now?
38 // Prototype for data model. TODO: remove the other setData methods and use something like this for now?
40 virtual bool setData(QAbstractItemModel* /*model*/) { return false; }
39 virtual bool setModel(QAbstractItemModel* /*model*/) { return false; }
41
42 // Methods for building a table for bar chart. Call repeatedly to add more than one series
43 virtual int addData(QList<qreal> data) {return -1;}
44 virtual void removeData(int id) {}
45 };
40 };
46
41
47 QTCOMMERCIALCHART_END_NAMESPACE
42 QTCOMMERCIALCHART_END_NAMESPACE
48
43
49 #endif
44 #endif
50
45
General Comments 0
You need to be logged in to leave comments. Login now