chartpresenter_p.h
176 lines
| 4.8 KiB
| text/x-c
|
CLexer
/ src / chartpresenter_p.h
Jani Honkonen
|
r794 | /**************************************************************************** | ||
** | ||||
** Copyright (C) 2012 Digia Plc | ||||
** 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$ | ||||
** | ||||
****************************************************************************/ | ||||
unknown
|
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. | ||||
Michal Klocek
|
r969 | #ifndef CHARTPRESENTER_H | ||
#define CHARTPRESENTER_H | ||||
Michal Klocek
|
r131 | |||
#include "qchartglobal.h" | ||||
Michal Klocek
|
r143 | #include "qchart.h" //becouse of QChart::ChartThemeId //TODO | ||
Michal Klocek
|
r131 | #include <QRectF> | ||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
Michal Klocek
|
r1736 | class ChartElement; | ||
Tero Ahola
|
r988 | class QAbstractSeries; | ||
Michal Klocek
|
r131 | class ChartDataSet; | ||
class Domain; | ||||
Michal Klocek
|
r1006 | class ChartAxis; | ||
Michal Klocek
|
r143 | class ChartTheme; | ||
Michal Klocek
|
r530 | class ChartAnimator; | ||
Michal Klocek
|
r1006 | class ChartBackground; | ||
Michal Klocek
|
r1241 | class ChartAnimation; | ||
Michal Klocek
|
r1534 | class ChartLayout; | ||
Michal Klocek
|
r131 | |||
class ChartPresenter: public QObject | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
Tero Ahola
|
r375 | enum ZValues { | ||
BackgroundZValue = -1, | ||||
Michal Klocek
|
r1747 | ShadesZValue , | ||
Tero Ahola
|
r375 | GridZValue, | ||
Tero Ahola
|
r1260 | SeriesZValue, | ||
LineChartZValue = SeriesZValue, | ||||
Michal Klocek
|
r1747 | SplineChartZValue = SeriesZValue, | ||
Tero Ahola
|
r1260 | BarSeriesZValue = SeriesZValue, | ||
ScatterSeriesZValue = SeriesZValue, | ||||
PieSeriesZValue = SeriesZValue, | ||||
Michal Klocek
|
r701 | AxisZValue, | ||
Michal Klocek
|
r1747 | LegendZValue, | ||
TopMostZValue | ||||
Tero Ahola
|
r375 | }; | ||
Tero Ahola
|
r1260 | |||
enum State { | ||||
ShowState, | ||||
Michal Klocek
|
r1241 | ScrollUpState, | ||
ScrollDownState, | ||||
ScrollLeftState, | ||||
ScrollRightState, | ||||
ZoomInState, | ||||
ZoomOutState | ||||
}; | ||||
Michal Klocek
|
r262 | |||
Michal Klocek
|
r131 | ChartPresenter(QChart* chart,ChartDataSet *dataset); | ||
virtual ~ChartPresenter(); | ||||
Michal Klocek
|
r139 | |||
Michal Klocek
|
r742 | ChartTheme *chartTheme() const { return m_chartTheme; } | ||
ChartDataSet *dataSet() const { return m_dataset; } | ||||
QGraphicsItem* rootItem() const { return m_chart; } | ||||
Michal Klocek
|
r1534 | QGraphicsRectItem* backgroundItem(); | ||
QGraphicsItem* titleItem(); | ||||
QList<ChartAxis*> axisItems() const; | ||||
QLegend* legend(); | ||||
void setBackgroundBrush(const QBrush& brush); | ||||
QBrush backgroundBrush() const; | ||||
void setBackgroundPen(const QPen& pen); | ||||
QPen backgroundPen() const; | ||||
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 setBackgroundVisible(bool visible); | ||||
bool isBackgroundVisible() const; | ||||
void setBackgroundDropShadowEnabled(bool enabled); | ||||
bool isBackgroundDropShadowEnabled() const; | ||||
void setVisible(bool visible); | ||||
Michal Klocek
|
r131 | |||
Michal Klocek
|
r740 | void setTheme(QChart::ChartTheme theme,bool force = true); | ||
QChart::ChartTheme theme(); | ||||
Michal Klocek
|
r143 | |||
Michal Klocek
|
r298 | void setAnimationOptions(QChart::AnimationOptions options); | ||
QChart::AnimationOptions animationOptions() const; | ||||
Jani Honkonen
|
r1187 | void zoomIn(qreal factor); | ||
Michal Klocek
|
r439 | void zoomIn(const QRectF& rect); | ||
Jani Honkonen
|
r1187 | void zoomOut(qreal factor); | ||
Michal Klocek
|
r1267 | void scroll(qreal dx,qreal dy); | ||
Jani Honkonen
|
r659 | |||
Michal Klocek
|
r855 | void setGeometry(const QRectF& rect); | ||
Michal Klocek
|
r1534 | QRectF geometry() { return m_rect; } | ||
Michal Klocek
|
r855 | |||
Michal Klocek
|
r1241 | void startAnimation(ChartAnimation* animation); | ||
State state() const { return m_state; } | ||||
QPointF statePoint() const { return m_statePoint; } | ||||
Michal Klocek
|
r1534 | |||
Michal Klocek
|
r531 | void resetAllElements(); | ||
Michal Klocek
|
r1534 | |||
void setMarginsMinimum(const QRectF& margins); | ||||
QRectF margins() const; | ||||
QGraphicsLayout* layout(); | ||||
private: | ||||
void createBackgroundItem(); | ||||
void createTitleItem(); | ||||
Michal Klocek
|
r1628 | void selectVisibleAxis(); | ||
Michal Klocek
|
r131 | |||
sauimone
|
r775 | public Q_SLOTS: | ||
Tero Ahola
|
r988 | void handleSeriesAdded(QAbstractSeries* series,Domain* domain); | ||
void handleSeriesRemoved(QAbstractSeries* series); | ||||
Michal Klocek
|
r1541 | void handleAxisAdded(QAbstractAxis* axis,Domain* domain); | ||
void handleAxisRemoved(QAbstractAxis* axis); | ||||
Michal Klocek
|
r1626 | void handleAxisVisibleChanged(bool visible); | ||
Michal Klocek
|
r439 | |||
Michal Klocek
|
r1241 | private Q_SLOTS: | ||
void handleAnimationFinished(); | ||||
sauimone
|
r775 | Q_SIGNALS: | ||
Michal Klocek
|
r139 | void geometryChanged(const QRectF& rect); | ||
Michal Klocek
|
r1241 | void animationsFinished(); | ||
Tero Ahola
|
r1524 | void marginsChanged(QRectF margins); | ||
Michal Klocek
|
r855 | |||
Michal Klocek
|
r131 | private: | ||
QChart* m_chart; | ||||
ChartDataSet* m_dataset; | ||||
Michal Klocek
|
r143 | ChartTheme *m_chartTheme; | ||
Michal Klocek
|
r1736 | QMap<QAbstractSeries*, ChartElement*> m_chartItems; | ||
Michal Klocek
|
r1541 | QMap<QAbstractAxis*, ChartAxis*> m_axisItems; | ||
Michal Klocek
|
r131 | QRectF m_rect; | ||
Michal Klocek
|
r298 | QChart::AnimationOptions m_options; | ||
Michal Klocek
|
r1241 | State m_state; | ||
QPointF m_statePoint; | ||||
QList<ChartAnimation*> m_animations; | ||||
Michal Klocek
|
r1534 | ChartLayout* m_layout; | ||
Michal Klocek
|
r855 | ChartBackground* m_backgroundItem; | ||
QGraphicsSimpleTextItem* m_titleItem; | ||||
Michal Klocek
|
r131 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif /* CHARTPRESENTER_H_ */ | ||||