qchartview.h
71 lines
| 1.9 KiB
| text/x-c
|
CLexer
/ src / qchartview.h
|
r58 | #ifndef QCHARTWIDGET_H | ||
#define QCHARTWIDGET_H | ||||
#include "qchartglobal.h" | ||||
#include "qchartseries.h" | ||||
|
r86 | #include "qchart.h" | ||
|
r58 | #include <QGraphicsView> | ||
class QGraphicsScene; | ||||
|
r136 | class QRubberBand; | ||
|
r58 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
class QChart; | ||||
class QTCOMMERCIALCHART_EXPORT QChartView : public QGraphicsView | ||||
{ | ||||
public: | ||||
|
r136 | enum RubberBandPolicy { NoRubberBand, VerticalRubberBand, HorizonalRubberBand, RectangleRubberBand }; | ||
|
r58 | explicit QChartView(QWidget *parent = 0); | ||
~QChartView(); | ||||
//implement from QWidget | ||||
void resizeEvent(QResizeEvent *event); | ||||
|
r223 | |||
|
r258 | void addSeries(QChartSeries* series,QChartAxis* axisY=0);// takes series ownership , takes axis ownership | ||
void removeSeries(QChartSeries* series); //returns ownership , deletes axis if no series attached | ||||
void removeAllSeries(); // deletes series and axis | ||||
|
r67 | int margin() const; | ||
|
r136 | |||
|
r192 | void setChartTitle(const QString& title); | ||
void setChartTitleFont(const QFont& font); | ||||
|
r122 | void setChartBackgroundBrush(const QBrush& brush); | ||
void setChartBackgroundPen(const QPen& pen); | ||||
|
r67 | void zoomIn(); | ||
|
r223 | void zoomIn(const QRect& rect); | ||
|
r67 | void zoomOut(); | ||
|
r58 | |||
|
r136 | void setRubberBandPolicy(const RubberBandPolicy ); | ||
RubberBandPolicy rubberBandPolicy() const; | ||||
|
r153 | void setChartTheme(QChart::ChartTheme theme); | ||
QChart::ChartTheme chartTheme() const; | ||||
|
r136 | |||
|
r223 | QChartAxis* axisX() const; | ||
QChartAxis* axisY() const; | ||||
|
r155 | |||
|
r136 | protected: | ||
void mousePressEvent(QMouseEvent *event); | ||||
void mouseMoveEvent(QMouseEvent *event); | ||||
void mouseReleaseEvent(QMouseEvent *event); | ||||
void keyPressEvent(QKeyEvent *event); | ||||
|
r58 | private: | ||
QGraphicsScene *m_scene; | ||||
QChart* m_chart; | ||||
|
r136 | QPoint m_rubberBandOrigin; | ||
QRubberBand* m_rubberBand; | ||||
bool m_verticalRubberBand; | ||||
bool m_horizonalRubberBand; | ||||
|
r58 | Q_DISABLE_COPY(QChartView) | ||
}; | ||||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // QCHARTWIDGET_H | ||||