qchart.h
123 lines
| 2.9 KiB
| text/x-c
|
CLexer
/ src / qchart.h
|
r264 | #ifndef QCHART_H | ||
#define QCHART_H | ||||
|
r12 | |||
|
r30 | #include <qchartglobal.h> | ||
|
r360 | #include <qseries.h> | ||
|
r115 | #include <QGraphicsWidget> | ||
|
r69 | #include <QLinearGradient> | ||
|
r87 | #include <QFont> | ||
|
r12 | |||
|
r115 | class QGraphicsSceneResizeEvent; | ||
|
r30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||
|
r12 | |||
|
r677 | class Axis; | ||
|
r360 | class QSeries; | ||
|
r67 | class PlotDomain; | ||
|
r666 | class BarChartItem; | ||
|
r72 | class QChartAxis; | ||
|
r103 | class ChartTheme; | ||
|
r108 | class ChartItem; | ||
|
r131 | class ChartDataSet; | ||
class ChartPresenter; | ||||
|
r524 | class QLegend; | ||
|
r639 | class ChartBackground; | ||
|
r21 | |||
|
r115 | class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsWidget | ||
|
r38 | { | ||
|
r48 | Q_OBJECT | ||
|
r64 | public: | ||
|
r298 | enum ChartTheme { | ||
|
r103 | ChartThemeDefault, | ||
|
r651 | ChartThemeLight, | ||
ChartThemeBlueCerulean, | ||||
ChartThemeDark, | ||||
ChartThemeBrownSand, | ||||
ChartThemeBlueNcs, | ||||
|
r81 | ChartThemeVanilla, | ||
|
r64 | ChartThemeIcy, | ||
|
r77 | ChartThemeGrayscale, | ||
|
r581 | ChartThemeScientific, | ||
ChartThemeCount | ||||
|
r64 | }; | ||
|
r298 | enum AnimationOption { | ||
NoAnimation = 0x0, | ||||
GridAxisAnimations = 0x1, | ||||
SeriesAnimations =0x2, | ||||
AllAnimations = 0x3 | ||||
}; | ||||
Q_DECLARE_FLAGS(AnimationOptions, AnimationOption) | ||||
|
r12 | public: | ||
|
r115 | QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); | ||
|
r48 | ~QChart(); | ||
|
r12 | |||
|
r360 | void addSeries(QSeries* series, QChartAxis* axisY = 0); | ||
void removeSeries(QSeries* series); //returns ownership , deletes axis if no series attached | ||||
|
r258 | void removeAllSeries(); // deletes series and axis | ||
|
r12 | |||
|
r153 | void setChartTheme(QChart::ChartTheme theme); | ||
QChart::ChartTheme chartTheme() const; | ||||
|
r28 | |||
|
r645 | void setTitle(const QString& title); | ||
QString title() const; | ||||
void setTitleFont(const QFont& font); | ||||
QFont titleFont() const; | ||||
void setTitleBrush(const QBrush &brush); | ||||
QBrush titleBrush() const; | ||||
void setBackgroundBrush(const QBrush& brush); | ||||
QBrush backgroundBrush() const; | ||||
void setBackgroundPen(const QPen& pen); | ||||
QPen backgroundPen() const; | ||||
void setBackgroundVisible(bool visible); | ||||
bool isBackgroundVisible() const; | ||||
|
r122 | |||
|
r298 | void setAnimationOptions(AnimationOptions options); | ||
AnimationOptions animationOptions() const; | ||||
|
r67 | void zoomIn(); | ||
|
r223 | void zoomIn(const QRectF& rect); | ||
|
r67 | void zoomOut(); | ||
|
r600 | void scrollLeft(); | ||
void scrollRight(); | ||||
void scrollUp(); | ||||
void scrollDown(); | ||||
|
r67 | |||
|
r223 | QChartAxis* axisX() const; | ||
QChartAxis* axisY() const; | ||||
|
r72 | |||
|
r652 | QLegend* legend() const; | ||
|
r639 | |||
int padding() const; | ||||
|
r115 | protected: | ||
void resizeEvent(QGraphicsSceneResizeEvent *event); | ||||
|
r223 | private: | ||
inline void createChartBackgroundItem(); | ||||
inline void createChartTitleItem(); | ||||
|
r639 | void setPadding(int padding); | ||
void setBackgroundPadding(int padding); | ||||
void setBackgroundDiameter(int diameter); | ||||
|
r571 | void updateLayout(); | ||
|
r223 | |||
|
r12 | private: | ||
|
r28 | Q_DISABLE_COPY(QChart) | ||
|
r639 | ChartBackground* m_backgroundItem; | ||
|
r476 | QGraphicsSimpleTextItem* m_titleItem; | ||
|
r115 | QRectF m_rect; | ||
|
r550 | QLegend* m_legend; | ||
|
r131 | ChartDataSet *m_dataset; | ||
ChartPresenter *m_presenter; | ||||
|
r639 | int m_padding; | ||
int m_backgroundPadding; | ||||
|
r12 | }; | ||
|
r30 | QTCOMMERCIALCHART_END_NAMESPACE | ||
|
r12 | |||
|
r298 | Q_DECLARE_OPERATORS_FOR_FLAGS(QTCOMMERCIALCHART_NAMESPACE::QChart::AnimationOptions) | ||
|
r12 | #endif | ||