chartpresenter_p.h
125 lines
| 3.5 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$ | ||||
** | ||||
****************************************************************************/ | ||||
Michal Klocek
|
r969 | #ifndef CHARTPRESENTER_H | ||
#define CHARTPRESENTER_H | ||||
Michal Klocek
|
r131 | |||
#include "qchartglobal.h" | ||||
Michal Klocek
|
r855 | #include "chartbackground_p.h" //TODO fix me | ||
Michal Klocek
|
r143 | #include "qchart.h" //becouse of QChart::ChartThemeId //TODO | ||
Michal Klocek
|
r176 | #include "qchartaxis.h" | ||
Michal Klocek
|
r131 | #include <QRectF> | ||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
Michal Klocek
|
r677 | class Chart; | ||
Tero Ahola
|
r988 | class QAbstractSeries; | ||
Michal Klocek
|
r131 | class ChartDataSet; | ||
class Domain; | ||||
Michal Klocek
|
r677 | class Axis; | ||
Michal Klocek
|
r143 | class ChartTheme; | ||
Michal Klocek
|
r530 | class ChartAnimator; | ||
Michal Klocek
|
r131 | |||
class ChartPresenter: public QObject | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
Tero Ahola
|
r375 | enum ZValues { | ||
BackgroundZValue = -1, | ||||
ShadesZValue, | ||||
GridZValue, | ||||
LineChartZValue, | ||||
sauimone
|
r594 | BarSeriesZValue, | ||
Tero Ahola
|
r490 | ScatterSeriesZValue, | ||
sauimone
|
r540 | PieSeriesZValue, | ||
Michal Klocek
|
r701 | AxisZValue, | ||
sauimone
|
r540 | LegendZValue | ||
Tero Ahola
|
r375 | }; | ||
Michal Klocek
|
r262 | |||
Michal Klocek
|
r131 | ChartPresenter(QChart* chart,ChartDataSet *dataset); | ||
virtual ~ChartPresenter(); | ||||
Michal Klocek
|
r139 | |||
Michal Klocek
|
r742 | ChartAnimator* animator() const { return m_animator; } | ||
ChartTheme *chartTheme() const { return m_chartTheme; } | ||||
ChartDataSet *dataSet() const { return m_dataset; } | ||||
QGraphicsItem* rootItem() const { return m_chart; } | ||||
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; | ||||
Michal Klocek
|
r439 | void zoomIn(); | ||
void zoomIn(const QRectF& rect); | ||||
void zoomOut(); | ||||
Michal Klocek
|
r531 | void scroll(int dx,int dy); | ||
Jani Honkonen
|
r659 | |||
Michal Klocek
|
r855 | void setGeometry(const QRectF& rect); | ||
QRectF chartGeometry() const { return m_chartRect; } | ||||
void setMinimumMarginHeight(Axis* axis, qreal height); | ||||
void setMinimumMarginWidth(Axis* axis, qreal width); | ||||
qreal minimumLeftMargin() const { return m_minLeftMargin; } | ||||
qreal minimumBottomMargin() const { return m_minBottomMargin; } | ||||
public: //TODO: fix me | ||||
Michal Klocek
|
r531 | void resetAllElements(); | ||
Michal Klocek
|
r855 | void createChartBackgroundItem(); | ||
void createChartTitleItem(); | ||||
Michal Klocek
|
r874 | QRectF margins() const { return m_chartMargins;} | ||
Michal Klocek
|
r131 | |||
sauimone
|
r775 | public Q_SLOTS: | ||
Tero Ahola
|
r988 | void handleSeriesAdded(QAbstractSeries* series,Domain* domain); | ||
void handleSeriesRemoved(QAbstractSeries* series); | ||||
Michal Klocek
|
r439 | void handleAxisAdded(QChartAxis* axis,Domain* domain); | ||
Michal Klocek
|
r223 | void handleAxisRemoved(QChartAxis* axis); | ||
Michal Klocek
|
r855 | void updateLayout(); | ||
Michal Klocek
|
r439 | |||
sauimone
|
r775 | Q_SIGNALS: | ||
Michal Klocek
|
r139 | void geometryChanged(const QRectF& rect); | ||
Michal Klocek
|
r439 | |||
Michal Klocek
|
r855 | |||
Michal Klocek
|
r131 | private: | ||
QChart* m_chart; | ||||
Michal Klocek
|
r530 | ChartAnimator* m_animator; | ||
Michal Klocek
|
r131 | ChartDataSet* m_dataset; | ||
Michal Klocek
|
r143 | ChartTheme *m_chartTheme; | ||
Tero Ahola
|
r988 | QMap<QAbstractSeries *, Chart *> m_chartItems; | ||
QMap<QChartAxis *, Axis *> m_axisItems; | ||||
Michal Klocek
|
r131 | QRectF m_rect; | ||
Michal Klocek
|
r855 | QRectF m_chartRect; | ||
Michal Klocek
|
r298 | QChart::AnimationOptions m_options; | ||
Michal Klocek
|
r855 | qreal m_minLeftMargin; | ||
qreal m_minBottomMargin; | ||||
public: //TODO: fixme | ||||
ChartBackground* m_backgroundItem; | ||||
QGraphicsSimpleTextItem* m_titleItem; | ||||
int m_marginBig; | ||||
int m_marginSmall; | ||||
int m_marginTiny; | ||||
Michal Klocek
|
r874 | QRectF m_chartMargins; | ||
QRectF m_legendMargins; | ||||
Michal Klocek
|
r143 | |||
Michal Klocek
|
r131 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif /* CHARTPRESENTER_H_ */ | ||||