chartpresenter_p.h
166 lines
| 4.3 KiB
| text/x-c
|
CLexer
/ src / chartpresenter_p.h
|
r794 | /**************************************************************************** | ||
** | ||||
|
r2432 | ** Copyright (C) 2013 Digia Plc | ||
|
r794 | ** All rights reserved. | ||
** For any questions to Digia, please use contact form at http://qt.digia.com | ||||
** | ||||
** This file is part of the Qt Commercial Charts Add-on. | ||||
** | ||||
** $QT_BEGIN_LICENSE$ | ||||
** Licensees holding valid Qt Commercial licenses may use this file in | ||||
** accordance with the Qt Commercial License Agreement provided with the | ||||
** Software or, alternatively, in accordance with the terms contained in | ||||
** a written agreement between you and Digia. | ||||
** | ||||
** If you have questions regarding the use of this file, please use | ||||
** contact form at http://qt.digia.com | ||||
** $QT_END_LICENSE$ | ||||
** | ||||
****************************************************************************/ | ||||
|
r1366 | // W A R N I N G | ||
// ------------- | ||||
// | ||||
// This file is not part of the QtCommercial Chart API. It exists purely as an | ||||
// implementation detail. This header file may change from version to | ||||
// version without notice, or even be removed. | ||||
// | ||||
// We mean it. | ||||
|
r969 | #ifndef CHARTPRESENTER_H | ||
#define CHARTPRESENTER_H | ||||
|
r131 | |||
#include "qchartglobal.h" | ||||
|
r2439 | #include "qchart.h" //because of QChart::ChartThemeId | ||
|
r131 | #include <QRectF> | ||
|
r1883 | #include <QMargins> | ||
|
r131 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
|
r2273 | class ChartItem; | ||
class AxisItem; | ||||
|
r988 | class QAbstractSeries; | ||
|
r131 | class ChartDataSet; | ||
|
r2275 | class AbstractDomain; | ||
|
r2483 | class ChartAxisElement; | ||
|
r530 | class ChartAnimator; | ||
|
r1006 | class ChartBackground; | ||
|
r1965 | class ChartTitle; | ||
|
r1241 | class ChartAnimation; | ||
|
r2483 | class AbstractChartLayout; | ||
|
r131 | |||
class ChartPresenter: public QObject | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
|
r375 | enum ZValues { | ||
BackgroundZValue = -1, | ||||
|
r1747 | ShadesZValue , | ||
|
r375 | GridZValue, | ||
|
r1790 | AxisZValue, | ||
|
r1260 | SeriesZValue, | ||
LineChartZValue = SeriesZValue, | ||||
|
r1747 | SplineChartZValue = SeriesZValue, | ||
|
r1260 | BarSeriesZValue = SeriesZValue, | ||
ScatterSeriesZValue = SeriesZValue, | ||||
PieSeriesZValue = SeriesZValue, | ||||
|
r1747 | LegendZValue, | ||
TopMostZValue | ||||
|
r375 | }; | ||
|
r1260 | |||
enum State { | ||||
ShowState, | ||||
|
r1241 | ScrollUpState, | ||
ScrollDownState, | ||||
ScrollLeftState, | ||||
ScrollRightState, | ||||
ZoomInState, | ||||
ZoomOutState | ||||
}; | ||||
|
r262 | |||
|
r2483 | ChartPresenter(QChart *chart, QChart::ChartType type); | ||
|
r131 | virtual ~ChartPresenter(); | ||
|
r139 | |||
|
r2273 | |||
void setGeometry(QRectF rect); | ||||
QRectF geometry() const; | ||||
QGraphicsItem *rootItem(){ return m_chart; } | ||||
|
r2131 | ChartBackground *backgroundElement(); | ||
ChartTitle *titleElement(); | ||||
|
r2483 | QList<ChartAxisElement *> axisItems() const; | ||
|
r2273 | QList<ChartItem *> chartItems() const; | ||
|
r2131 | QLegend *legend(); | ||
|
r1534 | |||
|
r2131 | void setBackgroundBrush(const QBrush &brush); | ||
|
r1534 | QBrush backgroundBrush() const; | ||
|
r2131 | void setBackgroundPen(const QPen &pen); | ||
|
r1534 | QPen backgroundPen() const; | ||
|
r2131 | void setTitle(const QString &title); | ||
|
r1534 | QString title() const; | ||
|
r2131 | void setTitleFont(const QFont &font); | ||
|
r1534 | QFont titleFont() const; | ||
void setTitleBrush(const QBrush &brush); | ||||
QBrush titleBrush() const; | ||||
void setBackgroundVisible(bool visible); | ||||
bool isBackgroundVisible() const; | ||||
void setBackgroundDropShadowEnabled(bool enabled); | ||||
bool isBackgroundDropShadowEnabled() const; | ||||
void setVisible(bool visible); | ||||
|
r131 | |||
|
r298 | void setAnimationOptions(QChart::AnimationOptions options); | ||
QChart::AnimationOptions animationOptions() const; | ||||
|
r2131 | void startAnimation(ChartAnimation *animation); | ||
|
r2273 | |||
|
r2477 | //TODO refactor | ||
|
r2273 | void setState(State state,QPointF point); | ||
|
r1241 | State state() const { return m_state; } | ||
QPointF statePoint() const { return m_statePoint; } | ||||
|
r2483 | AbstractChartLayout *layout(); | ||
QChart::ChartType chartType() const { return m_chart->chartType(); } | ||||
|
r1534 | |||
private: | ||||
void createBackgroundItem(); | ||||
void createTitleItem(); | ||||
|
r131 | |||
|
r775 | public Q_SLOTS: | ||
|
r2273 | void handleSeriesAdded(QAbstractSeries *series); | ||
|
r2131 | void handleSeriesRemoved(QAbstractSeries *series); | ||
|
r2273 | void handleAxisAdded(QAbstractAxis *axis); | ||
|
r2131 | void handleAxisRemoved(QAbstractAxis *axis); | ||
|
r439 | |||
|
r1241 | private Q_SLOTS: | ||
void handleAnimationFinished(); | ||||
|
r775 | Q_SIGNALS: | ||
|
r1241 | void animationsFinished(); | ||
|
r855 | |||
|
r131 | private: | ||
|
r2131 | QChart *m_chart; | ||
|
r2273 | QList<ChartItem *> m_chartItems; | ||
|
r2483 | QList<ChartAxisElement *> m_axisItems; | ||
|
r2273 | QList<QAbstractSeries *> m_series; | ||
QList<QAbstractAxis *> m_axes; | ||||
|
r298 | QChart::AnimationOptions m_options; | ||
|
r1241 | State m_state; | ||
QPointF m_statePoint; | ||||
|
r2131 | QList<ChartAnimation *> m_animations; | ||
|
r2483 | AbstractChartLayout *m_layout; | ||
|
r2131 | ChartBackground *m_background; | ||
ChartTitle *m_title; | ||||
|
r2273 | QRectF m_rect; | ||
|
r131 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
|
r1935 | #endif /* CHARTPRESENTER_H */ | ||