chartpresenter_p.h
106 lines
| 2.9 KiB
| text/x-c
|
CLexer
/ src / chartpresenter_p.h
|
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$ | ||||
** | ||||
****************************************************************************/ | ||||
|
r131 | #ifndef CHARTPRESENTER_H_ | ||
#define CHARTPRESENTER_H_ | ||||
#include "qchartglobal.h" | ||||
|
r143 | #include "qchart.h" //becouse of QChart::ChartThemeId //TODO | ||
|
r176 | #include "qchartaxis.h" | ||
|
r131 | #include <QRectF> | ||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
|
r677 | class Chart; | ||
|
r360 | class QSeries; | ||
|
r131 | class ChartDataSet; | ||
class Domain; | ||||
|
r677 | class Axis; | ||
|
r143 | class ChartTheme; | ||
|
r530 | class ChartAnimator; | ||
|
r131 | |||
class ChartPresenter: public QObject | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
|
r375 | enum ZValues { | ||
BackgroundZValue = -1, | ||||
ShadesZValue, | ||||
GridZValue, | ||||
LineChartZValue, | ||||
|
r594 | BarSeriesZValue, | ||
|
r490 | ScatterSeriesZValue, | ||
|
r540 | PieSeriesZValue, | ||
|
r701 | AxisZValue, | ||
|
r540 | LegendZValue | ||
|
r375 | }; | ||
|
r262 | |||
|
r131 | ChartPresenter(QChart* chart,ChartDataSet *dataset); | ||
virtual ~ChartPresenter(); | ||||
|
r139 | |||
|
r742 | int backgroundPadding() const { return m_backgroundPadding; } | ||
QRectF geometry() const { return m_rect; } | ||||
ChartAnimator* animator() const { return m_animator; } | ||||
ChartTheme *chartTheme() const { return m_chartTheme; } | ||||
ChartDataSet *dataSet() const { return m_dataset; } | ||||
QGraphicsItem* rootItem() const { return m_chart; } | ||||
|
r131 | |||
|
r740 | void setTheme(QChart::ChartTheme theme,bool force = true); | ||
QChart::ChartTheme theme(); | ||||
|
r143 | |||
|
r298 | void setAnimationOptions(QChart::AnimationOptions options); | ||
QChart::AnimationOptions animationOptions() const; | ||||
|
r439 | void zoomIn(); | ||
void zoomIn(const QRectF& rect); | ||||
void zoomOut(); | ||||
|
r531 | void scroll(int dx,int dy); | ||
|
r659 | |||
|
r131 | private: | ||
|
r140 | void createConnections(); | ||
|
r531 | void resetAllElements(); | ||
|
r131 | |||
|
r775 | public Q_SLOTS: | ||
|
r439 | void handleSeriesAdded(QSeries* series,Domain* domain); | ||
|
r360 | void handleSeriesRemoved(QSeries* series); | ||
|
r439 | void handleAxisAdded(QChartAxis* axis,Domain* domain); | ||
|
r223 | void handleAxisRemoved(QChartAxis* axis); | ||
|
r131 | void handleGeometryChanged(); | ||
|
r439 | |||
|
r775 | Q_SIGNALS: | ||
|
r139 | void geometryChanged(const QRectF& rect); | ||
|
r439 | |||
|
r131 | private: | ||
QChart* m_chart; | ||||
|
r530 | ChartAnimator* m_animator; | ||
|
r131 | ChartDataSet* m_dataset; | ||
|
r143 | ChartTheme *m_chartTheme; | ||
|
r677 | QMap<QSeries*,Chart*> m_chartItems; | ||
QMap<QChartAxis*,Axis*> m_axisItems; | ||||
|
r131 | QRectF m_rect; | ||
|
r298 | QChart::AnimationOptions m_options; | ||
|
r645 | bool m_themeForce; | ||
|
r742 | int m_backgroundPadding; | ||
|
r143 | |||
|
r131 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif /* CHARTPRESENTER_H_ */ | ||||