qchart.h
91 lines
| 2.3 KiB
| text/x-c
|
CLexer
/ src / qchart.h
Michal Klocek
|
r12 | #ifndef CHART_H | ||
#define CHART_H | ||||
Tero Ahola
|
r30 | #include <qchartglobal.h> | ||
Tero Ahola
|
r42 | #include <qchartseries.h> | ||
Tero Ahola
|
r48 | #include <QGraphicsObject> | ||
Michal Klocek
|
r69 | #include <QLinearGradient> | ||
Michal Klocek
|
r12 | |||
Tero Ahola
|
r30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||
Michal Klocek
|
r12 | |||
Michal Klocek
|
r67 | class AxisItem; | ||
Michal Klocek
|
r21 | class QChartSeries; | ||
Michal Klocek
|
r67 | class PlotDomain; | ||
class ChartItem; | ||||
sauimone
|
r56 | class BarGroup; | ||
Michal Klocek
|
r72 | class QChartAxis; | ||
Michal Klocek
|
r21 | |||
Tero Ahola
|
r42 | // TODO: We don't need to have QChart tied to QGraphicsItem: | ||
//class QTCOMMERCIALCHART_EXPORT QChart | ||||
//class QTCOMMERCIALCHART_EXPORT QChartGraphicsItem : public QGraphicsItem { | ||||
// public: QChartGraphicsItem(QChart &chart); | ||||
/*! | ||||
* TODO: define the responsibilities | ||||
*/ | ||||
Tero Ahola
|
r48 | class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsObject | ||
Tero Ahola
|
r38 | { | ||
Tero Ahola
|
r48 | Q_OBJECT | ||
Tero Ahola
|
r64 | public: | ||
enum ChartTheme { | ||||
ChartThemeVanilla = 0, | ||||
ChartThemeIcy, | ||||
ChartThemeGrayscale | ||||
}; | ||||
Michal Klocek
|
r12 | public: | ||
Tero Ahola
|
r48 | QChart(QGraphicsObject* parent = 0); | ||
~QChart(); | ||||
Michal Klocek
|
r12 | |||
Michal Klocek
|
r21 | //from QGraphicsItem | ||
Tero Ahola
|
r48 | QRectF boundingRect() const; | ||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){}; | ||||
Michal Klocek
|
r21 | |||
void addSeries(QChartSeries* series); | ||||
Tero Ahola
|
r42 | //TODO: QChartSeries* createSeries(QSeriesData *data, QChartSeries::QChartSeriesType type); | ||
// TODO: who owns the series now? maybe owned by chart and returned a reference instead... | ||||
Tero Ahola
|
r61 | QChartSeries* createSeries(QChartSeries::QChartSeriesType type); | ||
Michal Klocek
|
r12 | |||
Michal Klocek
|
r67 | void setSize(const QSize& size); | ||
Michal Klocek
|
r12 | void setMargin(int margin); | ||
Michal Klocek
|
r28 | int margin() const; | ||
Tero Ahola
|
r64 | void setTheme(QChart::ChartTheme theme); | ||
Michal Klocek
|
r28 | |||
Michal Klocek
|
r69 | void setTitle(const QString& title); | ||
void setBackgroundColor(const QColor& color); | ||||
Michal Klocek
|
r67 | void zoomInToRect(const QRect& rectangle); | ||
void zoomIn(); | ||||
void zoomOut(); | ||||
Michal Klocek
|
r72 | void setAxisX(QChartAxis* axis){}; | ||
void setAxisY(QChartAxis* axis){}; | ||||
void setAxisY(QList<QChartAxis*> axis){}; | ||||
Tero Ahola
|
r48 | signals: | ||
Michal Klocek
|
r67 | //TODO chage to const QSize& size | ||
Tero Ahola
|
r54 | void sizeChanged(QRectF rect); | ||
void scaleChanged(qreal xscale, qreal yscale); | ||||
Michal Klocek
|
r12 | |||
private: | ||||
Michal Klocek
|
r28 | Q_DISABLE_COPY(QChart) | ||
Michal Klocek
|
r69 | QGraphicsRectItem* m_background; | ||
QLinearGradient m_backgroundGradient; | ||||
QGraphicsTextItem* m_title; | ||||
Michal Klocek
|
r67 | AxisItem* m_axisX; | ||
AxisItem* m_axisY; | ||||
Michal Klocek
|
r53 | QRect m_rect; | ||
QList<const QChartSeries*> m_series; | ||||
Michal Klocek
|
r67 | QVector<PlotDomain> m_plotDomainList; | ||
QList<ChartItem*> m_chartItems; | ||||
//TODO: remove | ||||
Michal Klocek
|
r53 | QList<QGraphicsItem*> m_items; | ||
int m_plotDataIndex; | ||||
int m_marginSize; | ||||
Tero Ahola
|
r64 | QList<QColor> m_themeColors; | ||
Michal Klocek
|
r12 | }; | ||
Tero Ahola
|
r30 | QTCOMMERCIALCHART_END_NAMESPACE | ||
Michal Klocek
|
r12 | |||
#endif | ||||