##// END OF EJS Templates
Add ownerships takeover to chartaxis
Add ownerships takeover to chartaxis

File last commit:

r229:a66d0f17c040
r248:ded845353666
Show More
qchartview.h
70 lines | 1.7 KiB | text/x-c | CLexer
#ifndef QCHARTWIDGET_H
#define QCHARTWIDGET_H
#include "qchartglobal.h"
#include "qchartseries.h"
#include "qchart.h"
#include <QGraphicsView>
class QGraphicsScene;
class QRubberBand;
QTCOMMERCIALCHART_BEGIN_NAMESPACE
class QChart;
class QTCOMMERCIALCHART_EXPORT QChartView : public QGraphicsView
{
public:
enum RubberBandPolicy { NoRubberBand, VerticalRubberBand, HorizonalRubberBand, RectangleRubberBand };
explicit QChartView(QWidget *parent = 0);
~QChartView();
//implement from QWidget
void resizeEvent(QResizeEvent *event);
void addSeries(QChartSeries* series,QChartAxis* axisY=0);// takes ownership
void removeSeries(QChartSeries* series);
int margin() const;
void setChartTitle(const QString& title);
void setChartTitleFont(const QFont& font);
void setChartBackgroundBrush(const QBrush& brush);
void setChartBackgroundPen(const QPen& pen);
void zoomIn();
void zoomIn(const QRect& rect);
void zoomOut();
void setRubberBandPolicy(const RubberBandPolicy );
RubberBandPolicy rubberBandPolicy() const;
void setChartTheme(QChart::ChartTheme theme);
QChart::ChartTheme chartTheme() const;
QChartAxis* axisX() const;
QChartAxis* axisY() const;
protected:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void keyPressEvent(QKeyEvent *event);
private:
QGraphicsScene *m_scene;
QChart* m_chart;
QPoint m_rubberBandOrigin;
QRubberBand* m_rubberBand;
bool m_verticalRubberBand;
bool m_horizonalRubberBand;
Q_DISABLE_COPY(QChartView)
};
QTCOMMERCIALCHART_END_NAMESPACE
#endif // QCHARTWIDGET_H