summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@digia.com>2012-04-10 18:12:17 +0300
committerMichal Klocek <michal.klocek@digia.com>2012-04-10 18:12:29 +0300
commitdb6eae90aaeac771c9a876920beb91bbbdf36bdc (patch)
treef8680c5bf5924fe9c92863a30e1e440542a9bc6d
parentecf1d49ffcb6b436753c5901f35dd376307b95fc (diff)
Fixes header guard style issues
-rw-r--r--src/animations/axisanimation_p.h4
-rw-r--r--src/animations/baranimation_p.h4
-rw-r--r--src/animations/chartanimation_p.h4
-rw-r--r--src/animations/chartanimator_p.h5
-rw-r--r--src/animations/pieanimation_p.h4
-rw-r--r--src/animations/piesliceanimation_p.h4
-rw-r--r--src/animations/splineanimation_p.h4
-rw-r--r--src/animations/xyanimation_p.h5
-rw-r--r--src/areachart/qareaseries.h4
-rw-r--r--src/areachart/qareaseries_p.h4
-rw-r--r--src/axis/axis_p.h4
-rw-r--r--src/axis/qchartaxis.h4
-rw-r--r--src/axis/qchartaxis_p.h4
-rw-r--r--src/axis/qchartaxiscategories.h4
-rw-r--r--src/axis/qchartaxiscategories_p.h4
-rw-r--r--src/barchart/barchartmodel.cpp6
-rw-r--r--src/barchart/qpercentbarseries_p.h4
-rw-r--r--src/barchart/qstackedbarseries_p.h4
-rw-r--r--src/chart_p.h4
-rw-r--r--src/chartbackground_p.h4
-rw-r--r--src/chartconfig_p.h4
-rw-r--r--src/chartdataset_p.h4
-rw-r--r--src/chartitem_p.h4
-rw-r--r--src/chartpresenter.cpp319
-rw-r--r--src/chartpresenter_p.h4
-rw-r--r--src/domain_p.h4
-rw-r--r--src/legend/legendscroller_p.h4
-rw-r--r--src/legend/qlegend_p.h4
-rw-r--r--src/linechart/qlineseries.h10
-rw-r--r--src/linechart/qlineseries_p.h4
-rw-r--r--src/qchartview.cpp437
-rw-r--r--src/qchartview_p.h1
-rw-r--r--src/qseries_p.h4
-rw-r--r--src/scatterseries/qscatterseries_p.h4
-rw-r--r--src/scatterseries/scatterchartitem_p.h4
-rw-r--r--src/scroller_p.h4
-rw-r--r--src/splinechart/qsplineseries_p.h4
-rw-r--r--src/themes/chartthemeblueicy_p.h4
-rw-r--r--src/themes/chartthemelight_p.h4
-rw-r--r--src/xychart/qxyseries.h4
-rw-r--r--src/xychart/qxyseries_p.h4
41 files changed, 460 insertions, 459 deletions
diff --git a/src/animations/axisanimation_p.h b/src/animations/axisanimation_p.h
index 6d92b338..9e6dd182 100644
--- a/src/animations/axisanimation_p.h
+++ b/src/animations/axisanimation_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef AXISANIMATIONITEM_H_
-#define AXISANIMATIONITEM_H_
+#ifndef AXISANIMATION_H
+#define AXISANIMATION_H
#include "axis_p.h"
#include "chartanimation_p.h"
diff --git a/src/animations/baranimation_p.h b/src/animations/baranimation_p.h
index 96d4ebd0..d5e6c831 100644
--- a/src/animations/baranimation_p.h
+++ b/src/animations/baranimation_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef BARANIMATION_P_H_
-#define BARANIMATION_P_H_
+#ifndef BARANIMATION_P_H
+#define BARANIMATION_P_H
#include "chartanimation_p.h"
#include "barchartitem_p.h"
diff --git a/src/animations/chartanimation_p.h b/src/animations/chartanimation_p.h
index 2ec5950c..fa12c80d 100644
--- a/src/animations/chartanimation_p.h
+++ b/src/animations/chartanimation_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef CHARTANIMATION_H_
-#define CHARTANIMATION_H_
+#ifndef CHARTANIMATION_H
+#define CHARTANIMATION_H
#include "qchartglobal.h"
#include <QVariantAnimation>
diff --git a/src/animations/chartanimator_p.h b/src/animations/chartanimator_p.h
index 2dd0d682..24ae79ac 100644
--- a/src/animations/chartanimator_p.h
+++ b/src/animations/chartanimator_p.h
@@ -18,8 +18,9 @@
**
****************************************************************************/
-#ifndef CHARTANIMATOR_P_H_
-#define CHARTANIMATOR_P_H_
+#ifndef CHARTANIMATOR_P_H
+#define CHARTANIMATOR_P_H
+
#include "qchartglobal.h"
#include "chartanimation_p.h"
#include "piechartitem_p.h"
diff --git a/src/animations/pieanimation_p.h b/src/animations/pieanimation_p.h
index 074617de..c9f17969 100644
--- a/src/animations/pieanimation_p.h
+++ b/src/animations/pieanimation_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef PIEANIMATION_P_H_
-#define PIEANIMATION_P_H_
+#ifndef PIEANIMATION_P_H
+#define PIEANIMATION_P_H
#include "chartanimation_p.h"
#include "piechartitem_p.h"
diff --git a/src/animations/piesliceanimation_p.h b/src/animations/piesliceanimation_p.h
index c6cc9c5b..c73bea61 100644
--- a/src/animations/piesliceanimation_p.h
+++ b/src/animations/piesliceanimation_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef PIESLICEANIMATION_P_H_
-#define PIESLICEANIMATION_P_H_
+#ifndef PIESLICEANIMATION_P_H
+#define PIESLICEANIMATION_P_H
#include "piechartitem_p.h"
#include <QVariantAnimation>
diff --git a/src/animations/splineanimation_p.h b/src/animations/splineanimation_p.h
index fc8b46a2..d23dd9b2 100644
--- a/src/animations/splineanimation_p.h
+++ b/src/animations/splineanimation_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef SPLINEANIMATION_P_H_
-#define SPLINEANIMATION_P_H_
+#ifndef SPLINEANIMATION_P_H
+#define SPLINEANIMATION_P_H
#include "chartanimation_p.h"
#include <QPointF>
diff --git a/src/animations/xyanimation_p.h b/src/animations/xyanimation_p.h
index d0abd4d7..eed68034 100644
--- a/src/animations/xyanimation_p.h
+++ b/src/animations/xyanimation_p.h
@@ -18,8 +18,9 @@
**
****************************************************************************/
-#ifndef XYCHARTANIMATION_P_H_
-#define XYCHARTANIMATION_P_H_
+#ifndef XYANIMATION_P_H
+#define XYANIMATION_P_H
+
#include "chartanimation_p.h"
#include <QPointF>
diff --git a/src/areachart/qareaseries.h b/src/areachart/qareaseries.h
index 033b4edf..f4e66686 100644
--- a/src/areachart/qareaseries.h
+++ b/src/areachart/qareaseries.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef QAREASERIES_H_
-#define QAREASERIES_H_
+#ifndef QAREASERIES_H
+#define QAREASERIES_H
#include <qchartglobal.h>
#include <qseries.h>
diff --git a/src/areachart/qareaseries_p.h b/src/areachart/qareaseries_p.h
index 1b77996f..56e3c959 100644
--- a/src/areachart/qareaseries_p.h
+++ b/src/areachart/qareaseries_p.h
@@ -27,8 +27,8 @@
//
// We mean it.
-#ifndef QAREASERIES_P_H_
-#define QAREASERIES_P_H_
+#ifndef QAREASERIES_P_H
+#define QAREASERIES_P_H
#include "qseries_p.h"
diff --git a/src/axis/axis_p.h b/src/axis/axis_p.h
index b138109e..22fa9ad7 100644
--- a/src/axis/axis_p.h
+++ b/src/axis/axis_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef AXISITEM_H_
-#define AXISITEM_H_
+#ifndef AXIS_H
+#define AXIS_H
#include "qchartglobal.h"
#include "chart_p.h"
diff --git a/src/axis/qchartaxis.h b/src/axis/qchartaxis.h
index 810fac5a..43618ba4 100644
--- a/src/axis/qchartaxis.h
+++ b/src/axis/qchartaxis.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef QCHARTAXIS_H_
-#define QCHARTAXIS_H_
+#ifndef QCHARTAXIS_H
+#define QCHARTAXIS_H
#include <qchartglobal.h>
#include <qchartaxiscategories.h>
diff --git a/src/axis/qchartaxis_p.h b/src/axis/qchartaxis_p.h
index dc428597..f31b903c 100644
--- a/src/axis/qchartaxis_p.h
+++ b/src/axis/qchartaxis_p.h
@@ -27,8 +27,8 @@
//
// We mean it.
-#ifndef QCHARTAXIS_P_H_
-#define QCHARTAXIS_P_H_
+#ifndef QCHARTAXIS_P_H
+#define QCHARTAXIS_P_H
#include "qchartaxis.h"
diff --git a/src/axis/qchartaxiscategories.h b/src/axis/qchartaxiscategories.h
index 974ed482..4a6e947a 100644
--- a/src/axis/qchartaxiscategories.h
+++ b/src/axis/qchartaxiscategories.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef QCHARTAXISCATEGORIES_H_
-#define QCHARTAXISCATEGORIES_H_
+#ifndef QCHARTAXISCATEGORIES_H
+#define QCHARTAXISCATEGORIES_H
#include <qchartglobal.h>
#include <qbarseries.h>
diff --git a/src/axis/qchartaxiscategories_p.h b/src/axis/qchartaxiscategories_p.h
index 6e67d8db..c3b05e63 100644
--- a/src/axis/qchartaxiscategories_p.h
+++ b/src/axis/qchartaxiscategories_p.h
@@ -27,8 +27,8 @@
//
// We mean it.
-#ifndef QCHARTAXISCATEGORIES_P_H_
-#define QCHARTAXISCATEGORIES_P_H_
+#ifndef QCHARTAXISCATEGORIES_P_H
+#define QCHARTAXISCATEGORIES_P_H
#include "qchartaxiscategories.h"
diff --git a/src/barchart/barchartmodel.cpp b/src/barchart/barchartmodel.cpp
index c07ab784..7a2eb4a3 100644
--- a/src/barchart/barchartmodel.cpp
+++ b/src/barchart/barchartmodel.cpp
@@ -18,11 +18,11 @@
**
****************************************************************************/
+#include "barchartmodel_p.h"
+#include "qbarset.h"
#include <limits.h>
#include <QVector>
#include <QDebug>
-#include "barchartmodel_p.h"
-#include "qbarset.h"
QTCOMMERCIALCHART_BEGIN_NAMESPACE
@@ -195,4 +195,4 @@ QString BarChartModel::categoryName(int category)
#include "moc_barchartmodel_p.cpp"
-QTCOMMERCIALCHART_END_NAMESPACE
+QTCOMMERCIALCHART_END_NAMESPACE \ No newline at end of file
diff --git a/src/barchart/qpercentbarseries_p.h b/src/barchart/qpercentbarseries_p.h
index 01e205ba..b296c915 100644
--- a/src/barchart/qpercentbarseries_p.h
+++ b/src/barchart/qpercentbarseries_p.h
@@ -27,8 +27,8 @@
//
// We mean it.
-#ifndef QPERCENTBARSERIES_P_H_
-#define QPERCENTBARSERIES_P_H_
+#ifndef QPERCENTBARSERIES_P_H
+#define QPERCENTBARSERIES_P_H
#include "qbarseries_p.h"
#include "domain_p.h"
diff --git a/src/barchart/qstackedbarseries_p.h b/src/barchart/qstackedbarseries_p.h
index 332e9ea5..0ff4011b 100644
--- a/src/barchart/qstackedbarseries_p.h
+++ b/src/barchart/qstackedbarseries_p.h
@@ -27,8 +27,8 @@
//
// We mean it.
-#ifndef QSTACKEDBARSERIES_P_H_
-#define QSTACKEDBARSERIES_P_H_
+#ifndef QSTACKEDBARSERIES_P_H
+#define QSTACKEDBARSERIES_P_H
#include "qbarseries_p.h"
#include "domain_p.h"
diff --git a/src/chart_p.h b/src/chart_p.h
index 5cd083db..32ac5247 100644
--- a/src/chart_p.h
+++ b/src/chart_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef CHART_H_
-#define CHART_H_
+#ifndef CHART_H
+#define CHART_H
#include "qchartglobal.h"
#include <QRect>
diff --git a/src/chartbackground_p.h b/src/chartbackground_p.h
index 2804ae84..93870ce3 100644
--- a/src/chartbackground_p.h
+++ b/src/chartbackground_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef CHARTBACKGROUND_H_
-#define CHARTBACKGROUND_H_
+#ifndef CHARTBACKGROUND_H
+#define CHARTBACKGROUND_H
#include "qchartglobal.h"
#include <QGraphicsRectItem>
diff --git a/src/chartconfig_p.h b/src/chartconfig_p.h
index 46010542..25e9ae3d 100644
--- a/src/chartconfig_p.h
+++ b/src/chartconfig_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef CHARTCONFIG_H_
-#define CHARTCONFIG_H_
+#ifndef CHARTCONFIG_H
+#define CHARTCONFIG_H
#include "qchartglobal.h"
#ifdef Q_CC_MSVC
diff --git a/src/chartdataset_p.h b/src/chartdataset_p.h
index 0a105c64..223e8d65 100644
--- a/src/chartdataset_p.h
+++ b/src/chartdataset_p.h
@@ -27,8 +27,8 @@
//
// We mean it.
-#ifndef CHARTDATASET_P_H_
-#define CHARTDATASET_P_H_
+#ifndef CHARTDATASET_P_H
+#define CHARTDATASET_P_H
#include "qseries.h"
#include "domain_p.h"
diff --git a/src/chartitem_p.h b/src/chartitem_p.h
index f6f46a00..ae9ddd6e 100644
--- a/src/chartitem_p.h
+++ b/src/chartitem_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef CHARTITEM_H_
-#define CHARTITEM_H_
+#ifndef CHARTITEM_H
+#define CHARTITEM_H
#include "chart_p.h"
#include "chartpresenter_p.h"
diff --git a/src/chartpresenter.cpp b/src/chartpresenter.cpp
index 9be6e4a1..7544cd25 100644
--- a/src/chartpresenter.cpp
+++ b/src/chartpresenter.cpp
@@ -1,27 +1,26 @@
/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
+ **
+ ** 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$
+ **
+ ****************************************************************************/
+#include "chartpresenter_p.h"
#include "qchart.h"
#include "qchart_p.h"
#include "qchartaxis.h"
-#include "chartpresenter_p.h"
#include "chartdataset_p.h"
#include "charttheme_p.h"
#include "chartanimator_p.h"
@@ -33,26 +32,26 @@
QTCOMMERCIALCHART_BEGIN_NAMESPACE
ChartPresenter::ChartPresenter(QChart* chart,ChartDataSet* dataset):QObject(chart),
- m_chart(chart),
- m_animator(0),
- m_dataset(dataset),
- m_chartTheme(0),
- m_chartRect(QRectF(QPoint(0,0),m_chart->size())),
- m_options(QChart::NoAnimation),
- m_minLeftMargin(0),
- m_minBottomMargin(0),
- m_backgroundItem(0),
- m_titleItem(0),
- m_marginBig(60),
- m_marginSmall(20),
- m_marginTiny(10),
- m_chartMargins(QRect(m_marginBig,m_marginBig,0,0))
+m_chart(chart),
+m_animator(0),
+m_dataset(dataset),
+m_chartTheme(0),
+m_chartRect(QRectF(QPoint(0,0),m_chart->size())),
+m_options(QChart::NoAnimation),
+m_minLeftMargin(0),
+m_minBottomMargin(0),
+m_backgroundItem(0),
+m_titleItem(0),
+m_marginBig(60),
+m_marginSmall(20),
+m_marginTiny(10),
+m_chartMargins(QRect(m_marginBig,m_marginBig,0,0))
{
}
ChartPresenter::~ChartPresenter()
{
- delete m_chartTheme;
+ delete m_chartTheme;
}
void ChartPresenter::setGeometry(const QRectF& rect)
@@ -65,23 +64,23 @@ void ChartPresenter::setGeometry(const QRectF& rect)
void ChartPresenter::setMinimumMarginWidth(Axis* axis, qreal width)
{
switch(axis->axisType()){
- case Axis::X_AXIS:
- {
- if(width>m_chartRect.width()+ m_chartMargins.left()) {
- m_minLeftMargin= width - m_chartRect.width();
- updateLayout();
- }
- break;
+ case Axis::X_AXIS:
+ {
+ if(width>m_chartRect.width()+ m_chartMargins.left()) {
+ m_minLeftMargin= width - m_chartRect.width();
+ updateLayout();
}
- case Axis::Y_AXIS:
- {
+ break;
+ }
+ case Axis::Y_AXIS:
+ {
- if(m_minLeftMargin!=width){
- m_minLeftMargin= width;
- updateLayout();
- }
- break;
+ if(m_minLeftMargin!=width){
+ m_minLeftMargin= width;
+ updateLayout();
}
+ break;
+ }
}
}
@@ -89,23 +88,23 @@ void ChartPresenter::setMinimumMarginWidth(Axis* axis, qreal width)
void ChartPresenter::setMinimumMarginHeight(Axis* axis, qreal height)
{
switch(axis->axisType()){
- case Axis::X_AXIS:
- {
- if(m_minBottomMargin!=height) {
- m_minBottomMargin= height;
- updateLayout();
- }
- break;
+ case Axis::X_AXIS:
+ {
+ if(m_minBottomMargin!=height) {
+ m_minBottomMargin= height;
+ updateLayout();
}
- case Axis::Y_AXIS:
- {
+ break;
+ }
+ case Axis::Y_AXIS:
+ {
- if(height>m_chartMargins.bottom()+m_chartRect.height()){
- m_minBottomMargin= height - m_chartRect.height();
- updateLayout();
- }
- break;
+ if(height>m_chartMargins.bottom()+m_chartRect.height()){
+ m_minBottomMargin= height - m_chartRect.height();
+ updateLayout();
}
+ break;
+ }
}
}
@@ -149,14 +148,14 @@ void ChartPresenter::handleAxisRemoved(QChartAxis* axis)
void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain)
{
- Chart *item = series->d_ptr->createGraphics(this);
- Q_ASSERT(item);
- QObject::connect(this,SIGNAL(geometryChanged(QRectF)),item,SLOT(handleGeometryChanged(QRectF)));
- QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),item,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
- //initialize
- item->handleDomainChanged(domain->minX(),domain->maxX(),domain->minY(),domain->maxY());
- if(m_chartRect.isValid()) item->handleGeometryChanged(m_chartRect);
- m_chartItems.insert(series,item);
+ Chart *item = series->d_ptr->createGraphics(this);
+ Q_ASSERT(item);
+ QObject::connect(this,SIGNAL(geometryChanged(QRectF)),item,SLOT(handleGeometryChanged(QRectF)));
+ QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),item,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
+ //initialize
+ item->handleDomainChanged(domain->minX(),domain->maxX(),domain->minY(),domain->maxY());
+ if(m_chartRect.isValid()) item->handleGeometryChanged(m_chartRect);
+ m_chartItems.insert(series,item);
}
void ChartPresenter::handleSeriesRemoved(QSeries* series)
@@ -166,19 +165,19 @@ void ChartPresenter::handleSeriesRemoved(QSeries* series)
if(m_animator) {
//small hack to handle area animations
if(series->type()==QSeries::SeriesTypeArea){
- QAreaSeries* areaSeries = static_cast<QAreaSeries*>(series);
- AreaChartItem* area = static_cast<AreaChartItem*>(item);
- m_animator->removeAnimation(area->upperLineItem());
- if(areaSeries->lowerSeries()) m_animator->removeAnimation(area->lowerLineItem());
+ QAreaSeries* areaSeries = static_cast<QAreaSeries*>(series);
+ AreaChartItem* area = static_cast<AreaChartItem*>(item);
+ m_animator->removeAnimation(area->upperLineItem());
+ if(areaSeries->lowerSeries()) m_animator->removeAnimation(area->lowerLineItem());
}else
- m_animator->removeAnimation(item);
+ m_animator->removeAnimation(item);
}
delete item;
}
void ChartPresenter::setTheme(QChart::ChartTheme theme,bool force)
{
- if(m_chartTheme && m_chartTheme->id() == theme) return;
+ if(m_chartTheme && m_chartTheme->id() == theme) return;
delete m_chartTheme;
m_chartTheme = ChartTheme::createTheme(theme);
m_chartTheme->setForced(force);
@@ -208,75 +207,75 @@ void ChartPresenter::setAnimationOptions(QChart::AnimationOptions options)
void ChartPresenter::resetAllElements()
{
- QList<QChartAxis*> axisList = m_axisItems.uniqueKeys();
- QList<QSeries*> seriesList = m_chartItems.uniqueKeys();
-
- foreach(QChartAxis* axis, axisList) {
- handleAxisRemoved(axis);
- handleAxisAdded(axis,m_dataset->domain(axis));
- }
- foreach(QSeries* series, seriesList) {
- handleSeriesRemoved(series);
- handleSeriesAdded(series,m_dataset->domain(series));
- }
+ QList<QChartAxis*> axisList = m_axisItems.uniqueKeys();
+ QList<QSeries*> seriesList = m_chartItems.uniqueKeys();
+
+ foreach(QChartAxis* axis, axisList) {
+ handleAxisRemoved(axis);
+ handleAxisAdded(axis,m_dataset->domain(axis));
+ }
+ foreach(QSeries* series, seriesList) {
+ handleSeriesRemoved(series);
+ handleSeriesAdded(series,m_dataset->domain(series));
+ }
}
void ChartPresenter::zoomIn()
{
- QRectF rect = chartGeometry();
- rect.setWidth(rect.width()/2);
- rect.setHeight(rect.height()/2);
- rect.moveCenter(chartGeometry().center());
- zoomIn(rect);
+ QRectF rect = chartGeometry();
+ rect.setWidth(rect.width()/2);
+ rect.setHeight(rect.height()/2);
+ rect.moveCenter(chartGeometry().center());
+ zoomIn(rect);
}
void ChartPresenter::zoomIn(const QRectF& rect)
{
- QRectF r = rect.normalized();
+ QRectF r = rect.normalized();
r.translate(-m_chartMargins.topLeft());
- if(m_animator) {
-
- QPointF point(r.center().x()/chartGeometry().width(),r.center().y()/chartGeometry().height());
- m_animator->setState(ChartAnimator::ZoomInState,point);
- }
- m_dataset->zoomInDomain(r,chartGeometry().size());
- if(m_animator) {
- m_animator->setState(ChartAnimator::ShowState);
- }
+ if(m_animator) {
+
+ QPointF point(r.center().x()/chartGeometry().width(),r.center().y()/chartGeometry().height());
+ m_animator->setState(ChartAnimator::ZoomInState,point);
+ }
+ m_dataset->zoomInDomain(r,chartGeometry().size());
+ if(m_animator) {
+ m_animator->setState(ChartAnimator::ShowState);
+ }
}
void ChartPresenter::zoomOut()
{
- if(m_animator)
- {
- m_animator->setState(ChartAnimator::ZoomOutState);
- }
+ if(m_animator)
+ {
+ m_animator->setState(ChartAnimator::ZoomOutState);
+ }
- QSizeF size = chartGeometry().size();
- QRectF rect = chartGeometry();
+ QSizeF size = chartGeometry().size();
+ QRectF rect = chartGeometry();
rect.translate(-m_chartMargins.topLeft());
m_dataset->zoomOutDomain(rect.adjusted(size.width()/4,size.height()/4,-size.width()/4,-size.height()/4),size);
//m_dataset->zoomOutDomain(m_zoomStack[m_zoomIndex-1],geometry().size());
- if(m_animator){
- m_animator->setState(ChartAnimator::ShowState);
- }
+ if(m_animator){
+ m_animator->setState(ChartAnimator::ShowState);
+ }
}
void ChartPresenter::scroll(int dx,int dy)
{
- if(m_animator){
- if(dx<0) m_animator->setState(ChartAnimator::ScrollLeftState,QPointF());
- if(dx>0) m_animator->setState(ChartAnimator::ScrollRightState,QPointF());
- if(dy<0) m_animator->setState(ChartAnimator::ScrollUpState,QPointF());
- if(dy>0) m_animator->setState(ChartAnimator::ScrollDownState,QPointF());
- }
+ if(m_animator){
+ if(dx<0) m_animator->setState(ChartAnimator::ScrollLeftState,QPointF());
+ if(dx>0) m_animator->setState(ChartAnimator::ScrollRightState,QPointF());
+ if(dy<0) m_animator->setState(ChartAnimator::ScrollUpState,QPointF());
+ if(dy>0) m_animator->setState(ChartAnimator::ScrollDownState,QPointF());
+ }
- m_dataset->scrollDomain(dx,dy,chartGeometry().size());
+ m_dataset->scrollDomain(dx,dy,chartGeometry().size());
if(m_animator){
- m_animator->setState(ChartAnimator::ShowState);
- }
+ m_animator->setState(ChartAnimator::ShowState);
+ }
}
QChart::AnimationOptions ChartPresenter::animationOptions() const
@@ -311,41 +310,41 @@ void ChartPresenter::updateLayout()
// Reserve some space for legend
switch (legend->alignment()) {
- case QLegend::AlignmentTop: {
- int ledgendSize = legend->minHeight();
- int topPadding = 2*m_marginTiny + titleSize.height() + ledgendSize + m_marginTiny;
- m_chartMargins = QRect(QPoint(m_chartMargins.left(),topPadding),QPoint(m_chartMargins.right(),m_chartMargins.bottom()));
- m_legendMargins = QRect(QPoint(m_chartMargins.left(),topPadding - (ledgendSize + m_marginTiny)),QPoint(m_chartMargins.right(),m_rect.height()-topPadding + m_marginTiny));
- titlePadding = m_marginTiny + m_marginTiny;
- break;
- }
- case QLegend::AlignmentBottom: {
- int ledgendSize = legend->minHeight();
- int bottomPadding = m_marginTiny + m_marginSmall + ledgendSize + m_marginTiny + m_minBottomMargin;
- m_chartMargins = QRect(QPoint(m_chartMargins.left(),m_chartMargins.top()),QPoint(m_chartMargins.right(),bottomPadding));
- m_legendMargins = QRect(QPoint(m_chartMargins.left(),m_rect.height()-bottomPadding + m_marginTiny + m_minBottomMargin),QPoint(m_chartMargins.right(),m_marginTiny + m_marginSmall));
- titlePadding = m_chartMargins.top()/2;
- break;
- }
- case QLegend::AlignmentLeft: {
- int ledgendSize = legend->minWidth();
- int leftPadding = m_marginTiny + m_marginSmall + ledgendSize + m_marginTiny + m_minLeftMargin;
- m_chartMargins = QRect(QPoint(leftPadding,m_chartMargins.top()),QPoint(m_chartMargins.right(),m_chartMargins.bottom()));
- m_legendMargins = QRect(QPoint(m_marginTiny + m_marginSmall,m_chartMargins.top()),QPoint(m_rect.width()-leftPadding + m_marginTiny + m_minLeftMargin,m_chartMargins.bottom()));
- titlePadding = m_chartMargins.top()/2;
- break;
- }
- case QLegend::AlignmentRight: {
- int ledgendSize = legend->minWidth();
- int rightPadding = m_marginTiny + m_marginSmall + ledgendSize + m_marginTiny;
- m_chartMargins = QRect(QPoint(m_chartMargins.left(),m_chartMargins.top()),QPoint(rightPadding,m_chartMargins.bottom()));
- m_legendMargins = QRect(QPoint(m_rect.width()- rightPadding+ m_marginTiny ,m_chartMargins.top()),QPoint(m_marginTiny + m_marginSmall,m_chartMargins.bottom()));
- titlePadding = m_chartMargins.top()/2;
- break;
- }
- default: {
- break;
- }
+ case QLegend::AlignmentTop: {
+ int ledgendSize = legend->minHeight();
+ int topPadding = 2*m_marginTiny + titleSize.height() + ledgendSize + m_marginTiny;
+ m_chartMargins = QRect(QPoint(m_chartMargins.left(),topPadding),QPoint(m_chartMargins.right(),m_chartMargins.bottom()));
+ m_legendMargins = QRect(QPoint(m_chartMargins.left(),topPadding - (ledgendSize + m_marginTiny)),QPoint(m_chartMargins.right(),m_rect.height()-topPadding + m_marginTiny));
+ titlePadding = m_marginTiny + m_marginTiny;
+ break;
+ }
+ case QLegend::AlignmentBottom: {
+ int ledgendSize = legend->minHeight();
+ int bottomPadding = m_marginTiny + m_marginSmall + ledgendSize + m_marginTiny + m_minBottomMargin;
+ m_chartMargins = QRect(QPoint(m_chartMargins.left(),m_chartMargins.top()),QPoint(m_chartMargins.right(),bottomPadding));
+ m_legendMargins = QRect(QPoint(m_chartMargins.left(),m_rect.height()-bottomPadding + m_marginTiny + m_minBottomMargin),QPoint(m_chartMargins.right(),m_marginTiny + m_marginSmall));
+ titlePadding = m_chartMargins.top()/2;
+ break;
+ }
+ case QLegend::AlignmentLeft: {
+ int ledgendSize = legend->minWidth();
+ int leftPadding = m_marginTiny + m_marginSmall + ledgendSize + m_marginTiny + m_minLeftMargin;
+ m_chartMargins = QRect(QPoint(leftPadding,m_chartMargins.top()),QPoint(m_chartMargins.right(),m_chartMargins.bottom()));
+ m_legendMargins = QRect(QPoint(m_marginTiny + m_marginSmall,m_chartMargins.top()),QPoint(m_rect.width()-leftPadding + m_marginTiny + m_minLeftMargin,m_chartMargins.bottom()));
+ titlePadding = m_chartMargins.top()/2;
+ break;
+ }
+ case QLegend::AlignmentRight: {
+ int ledgendSize = legend->minWidth();
+ int rightPadding = m_marginTiny + m_marginSmall + ledgendSize + m_marginTiny;
+ m_chartMargins = QRect(QPoint(m_chartMargins.left(),m_chartMargins.top()),QPoint(rightPadding,m_chartMargins.bottom()));
+ m_legendMargins = QRect(QPoint(m_rect.width()- rightPadding+ m_marginTiny ,m_chartMargins.top()),QPoint(m_marginTiny + m_marginSmall,m_chartMargins.bottom()));
+ titlePadding = m_chartMargins.top()/2;
+ break;
+ }
+ default: {
+ break;
+ }
}
}
@@ -372,10 +371,10 @@ void ChartPresenter::updateLayout()
legend->setGeometry(m_rect.adjusted(m_legendMargins.left(),m_legendMargins.top(),-m_legendMargins.right(),-m_legendMargins.bottom()));
- if(m_chartRect!=chartRect){
- m_chartRect=chartRect;
- emit geometryChanged(m_chartRect);
- }
+ if(m_chartRect!=chartRect){
+ m_chartRect=chartRect;
+ emit geometryChanged(m_chartRect);
+ }
}
diff --git a/src/chartpresenter_p.h b/src/chartpresenter_p.h
index e0f60a46..7eb993ba 100644
--- a/src/chartpresenter_p.h
+++ b/src/chartpresenter_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef CHARTPRESENTER_H_
-#define CHARTPRESENTER_H_
+#ifndef CHARTPRESENTER_H
+#define CHARTPRESENTER_H
#include "qchartglobal.h"
#include "chartbackground_p.h" //TODO fix me
diff --git a/src/domain_p.h b/src/domain_p.h
index eaf0f157..96ba8254 100644
--- a/src/domain_p.h
+++ b/src/domain_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef DOMAIN_H_
-#define DOMAIN_H_
+#ifndef DOMAIN_H
+#define DOMAIN_H
#include "qchartglobal.h"
#include <QRectF>
#include <QSizeF>
diff --git a/src/legend/legendscroller_p.h b/src/legend/legendscroller_p.h
index ccfe7016..e0061790 100644
--- a/src/legend/legendscroller_p.h
+++ b/src/legend/legendscroller_p.h
@@ -28,8 +28,8 @@
// We mean it.
-#ifndef LEGENDSCROLLER_P_H_
-#define LEGENDSCROLLER_P_H_
+#ifndef LEGENDSCROLLER_P_H
+#define LEGENDSCROLLER_P_H
#include "qlegend.h"
#include "scroller_p.h"
diff --git a/src/legend/qlegend_p.h b/src/legend/qlegend_p.h
index f30f705a..f5bbbb27 100644
--- a/src/legend/qlegend_p.h
+++ b/src/legend/qlegend_p.h
@@ -27,8 +27,8 @@
//
// We mean it.
-#ifndef QLEGEND_P_H_
-#define QLEGEND_P_H_
+#ifndef QLEGEND_P_H
+#define QLEGEND_P_H
#include "qlegend.h"
diff --git a/src/linechart/qlineseries.h b/src/linechart/qlineseries.h
index d8d0f64d..60d89f55 100644
--- a/src/linechart/qlineseries.h
+++ b/src/linechart/qlineseries.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef QLINESERIES_H_
-#define QLINESERIES_H_
+#ifndef QLINESERIES_H
+#define QLINESERIES_H
#include <qchartglobal.h>
#include <qxyseries.h>
@@ -33,12 +33,12 @@ class QTCOMMERCIALCHART_EXPORT QLineSeries : public QXYSeries
{
public:
explicit QLineSeries(QObject *parent=0);
- ~QLineSeries();
+ ~QLineSeries();
- QSeries::QSeriesType type() const;
+ QSeries::QSeriesType type() const;
protected:
- QLineSeries(QLineSeriesPrivate &d,QObject *parent = 0);
+ QLineSeries(QLineSeriesPrivate &d,QObject *parent = 0);
private:
Q_DECLARE_PRIVATE(QLineSeries);
diff --git a/src/linechart/qlineseries_p.h b/src/linechart/qlineseries_p.h
index 5ac29cf3..ae3f4117 100644
--- a/src/linechart/qlineseries_p.h
+++ b/src/linechart/qlineseries_p.h
@@ -27,8 +27,8 @@
//
// We mean it.
-#ifndef QLINESERIES_P_H_
-#define QLINESERIES_P_H_
+#ifndef QLINESERIES_P_H
+#define QLINESERIES_P_H
#include "qxyseries_p.h"
diff --git a/src/qchartview.cpp b/src/qchartview.cpp
index 51aa066b..95e82795 100644
--- a/src/qchartview.cpp
+++ b/src/qchartview.cpp
@@ -1,219 +1,218 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "qchartview.h"
-#include "qchart_p.h"
-#include "qchartview_p.h"
-#include <QGraphicsScene>
-#include <QRubberBand>
-
-
-/*!
- \enum QChartView::RubberBand
-
- This enum describes the different types of rubber bands that can be used for zoom rect selection
-
- \value NoRubberBand
- \value VerticalRubberBand
- \value HorizonalRubberBand
- \value RectangleRubberBand
-*/
-
-/*!
- \class QChartView
- \brief Standalone charting widget.
-
- QChartView is a standalone widget that can display charts. It does not require separate
- QGraphicsScene to work. It manages the graphical representation of different types of
- QChartSeries and other chart related objects like QChartAxis and QChartLegend. If you want to
- display a chart in your existing QGraphicsScene, you can use the QChart class instead.
-
- \sa QChart
-*/
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- Constructs a chartView object which is a child of a\a parent.
-*/
-QChartView::QChartView(QChart *chart,QWidget *parent) :
- QGraphicsView(parent),
- d_ptr(new QChartViewPrivate())
-{
- Q_ASSERT(chart);
- d_ptr->m_scene = new QGraphicsScene(this);
- d_ptr->m_chart = chart;
- setFrameShape(QFrame::NoFrame);
- setBackgroundRole(QPalette::Window);
- setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setScene(d_ptr->m_scene);
- d_ptr->m_scene->addItem(chart);
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-}
-
-
-/*!
- Destroys the object and it's children, like QChartSeries and QChartAxis object added to it.
-*/
-QChartView::~QChartView()
-{
-}
-
-/*!
- Returns the pointer to the associated chart
-*/
-QChart* QChartView::chart() const
-{
- return d_ptr->m_chart;
-}
-
-/*!
- Sets the RubberBandPlicy to \a rubberBand. Selected policy determines the way zooming is performed.
-*/
-void QChartView::setRubberBand(const RubberBands& rubberBand)
-{
- d_ptr->m_rubberBandFlags=rubberBand;
-
- if (!d_ptr->m_rubberBandFlags) {
- delete d_ptr->m_rubberBand;
- d_ptr->m_rubberBand=0;
- return;
- }
-
- if (!d_ptr->m_rubberBand) {
- d_ptr->m_rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
- d_ptr->m_rubberBand->setEnabled(true);
- }
-}
-
-/*!
- Returns the RubberBandPolicy that is currently being used by the widget.
-*/
-QChartView::RubberBands QChartView::rubberBand() const
-{
- return d_ptr->m_rubberBandFlags;
-}
-
-/*!
- If Left mouse button is pressed and the RubberBandPolicy is enabled the \a event is accepted and the rubber band is displayed on the screen allowing the user to select the zoom area.
- If different mouse button is pressed and/or the RubberBandPolicy is disabled then the \a event is passed to QGraphicsView::mousePressEvent() implementation.
-*/
-void QChartView::mousePressEvent(QMouseEvent *event)
-{
- if(d_ptr->m_rubberBand && d_ptr->m_rubberBand->isEnabled() && event->button() == Qt::LeftButton) {
-
- int padding = d_ptr->m_chart->margins().top();
- QRect rect(padding, padding, width() - 2 * padding, height() - 2 * padding);
-
- if (rect.contains(event->pos())) {
- d_ptr->m_rubberBandOrigin = event->pos();
- d_ptr->m_rubberBand->setGeometry(QRect(d_ptr->m_rubberBandOrigin, QSize()));
- d_ptr->m_rubberBand->show();
- event->accept();
- }
- }
- else {
- QGraphicsView::mousePressEvent(event);
- }
-}
-
-/*!
- If RubberBand rectange specification has been initiated in pressEvent then \a event data is used to update RubberBand geometry.
- In other case the defualt QGraphicsView::mouseMoveEvent implementation is called.
-*/
-void QChartView::mouseMoveEvent(QMouseEvent *event)
-{
- if(d_ptr->m_rubberBand && d_ptr->m_rubberBand->isVisible()) {
- QRectF margins = d_ptr->m_chart->margins();
- QRectF geometry = d_ptr->m_chart->geometry();
- QRectF rect =geometry.adjusted(margins.left(),margins.top(),-margins.right(),-margins.bottom());
- int width = event->pos().x() - d_ptr->m_rubberBandOrigin.x();
- int height = event->pos().y() - d_ptr->m_rubberBandOrigin.y();
- if (!d_ptr->m_rubberBandFlags.testFlag(VerticalRubberBand)) {
- d_ptr->m_rubberBandOrigin.setY(rect.top());
- height = rect.height();
- }
- if (!d_ptr->m_rubberBandFlags.testFlag(HorizonalRubberBand)) {
- d_ptr->m_rubberBandOrigin.setX(rect.left());
- width= rect.width();
- }
- d_ptr->m_rubberBand->setGeometry(QRect(d_ptr->m_rubberBandOrigin.x(),d_ptr->m_rubberBandOrigin.y(), width,height).normalized());
- }
- else {
- QGraphicsView::mouseMoveEvent(event);
- }
-}
-
-/*!
- If left mouse button is release and RubberBand is enabled then \a event is accepted and the view is zoomed in to rect specified by RubberBand
- If it is the right mouse button \a event then RubberBand is dissmissed and zoom is canceled.
-*/
-void QChartView::mouseReleaseEvent(QMouseEvent *event)
-{
- if(d_ptr->m_rubberBand) {
- if (event->button() == Qt::LeftButton && d_ptr->m_rubberBand->isVisible()) {
- d_ptr->m_rubberBand->hide();
- QRect rect = d_ptr->m_rubberBand->geometry();
- d_ptr->m_chart->zoomIn(rect);
- event->accept();
- }
-
- if(event->button()==Qt::RightButton){
- d_ptr->m_chart->zoomOut();
- event->accept();
- }
- }
- else {
- QGraphicsView::mouseReleaseEvent(event);
- }
-}
-
-/*!
- Resizes and updates the chart area using the \a event data
-*/
-void QChartView::resizeEvent(QResizeEvent *event)
-{
- QGraphicsView::resizeEvent(event);
- d_ptr->m_chart->resize(size());
- setMinimumSize(d_ptr->m_chart->minimumSize().toSize());
- setSceneRect(d_ptr->m_chart->geometry());
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QChartViewPrivate::QChartViewPrivate():
-m_scene(0),
-m_chart(0),
-m_presenter(0),
-m_rubberBand(0),
-m_rubberBandFlags(QChartView::NoRubberBand)
-{
-
-}
-
-QChartViewPrivate::~QChartViewPrivate()
-{
-
-}
-
-#include "moc_qchartview.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include "qchartview.h"
+#include "qchartview_p.h"
+#include "qchart_p.h"
+#include <QGraphicsScene>
+#include <QRubberBand>
+
+/*!
+ \enum QChartView::RubberBand
+
+ This enum describes the different types of rubber bands that can be used for zoom rect selection
+
+ \value NoRubberBand
+ \value VerticalRubberBand
+ \value HorizonalRubberBand
+ \value RectangleRubberBand
+*/
+
+/*!
+ \class QChartView
+ \brief Standalone charting widget.
+
+ QChartView is a standalone widget that can display charts. It does not require separate
+ QGraphicsScene to work. It manages the graphical representation of different types of
+ QChartSeries and other chart related objects like QChartAxis and QChartLegend. If you want to
+ display a chart in your existing QGraphicsScene, you can use the QChart class instead.
+
+ \sa QChart
+*/
+
+QTCOMMERCIALCHART_BEGIN_NAMESPACE
+
+/*!
+ Constructs a chartView object which is a child of a\a parent.
+*/
+QChartView::QChartView(QChart *chart,QWidget *parent) :
+ QGraphicsView(parent),
+ d_ptr(new QChartViewPrivate())
+{
+ Q_ASSERT(chart);
+ d_ptr->m_scene = new QGraphicsScene(this);
+ d_ptr->m_chart = chart;
+ setFrameShape(QFrame::NoFrame);
+ setBackgroundRole(QPalette::Window);
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setScene(d_ptr->m_scene);
+ d_ptr->m_scene->addItem(chart);
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+}
+
+
+/*!
+ Destroys the object and it's children, like QChartSeries and QChartAxis object added to it.
+*/
+QChartView::~QChartView()
+{
+}
+
+/*!
+ Returns the pointer to the associated chart
+*/
+QChart* QChartView::chart() const
+{
+ return d_ptr->m_chart;
+}
+
+/*!
+ Sets the RubberBandPlicy to \a rubberBand. Selected policy determines the way zooming is performed.
+*/
+void QChartView::setRubberBand(const RubberBands& rubberBand)
+{
+ d_ptr->m_rubberBandFlags=rubberBand;
+
+ if (!d_ptr->m_rubberBandFlags) {
+ delete d_ptr->m_rubberBand;
+ d_ptr->m_rubberBand=0;
+ return;
+ }
+
+ if (!d_ptr->m_rubberBand) {
+ d_ptr->m_rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
+ d_ptr->m_rubberBand->setEnabled(true);
+ }
+}
+
+/*!
+ Returns the RubberBandPolicy that is currently being used by the widget.
+*/
+QChartView::RubberBands QChartView::rubberBand() const
+{
+ return d_ptr->m_rubberBandFlags;
+}
+
+/*!
+ If Left mouse button is pressed and the RubberBandPolicy is enabled the \a event is accepted and the rubber band is displayed on the screen allowing the user to select the zoom area.
+ If different mouse button is pressed and/or the RubberBandPolicy is disabled then the \a event is passed to QGraphicsView::mousePressEvent() implementation.
+*/
+void QChartView::mousePressEvent(QMouseEvent *event)
+{
+ if(d_ptr->m_rubberBand && d_ptr->m_rubberBand->isEnabled() && event->button() == Qt::LeftButton) {
+
+ int padding = d_ptr->m_chart->margins().top();
+ QRect rect(padding, padding, width() - 2 * padding, height() - 2 * padding);
+
+ if (rect.contains(event->pos())) {
+ d_ptr->m_rubberBandOrigin = event->pos();
+ d_ptr->m_rubberBand->setGeometry(QRect(d_ptr->m_rubberBandOrigin, QSize()));
+ d_ptr->m_rubberBand->show();
+ event->accept();
+ }
+ }
+ else {
+ QGraphicsView::mousePressEvent(event);
+ }
+}
+
+/*!
+ If RubberBand rectange specification has been initiated in pressEvent then \a event data is used to update RubberBand geometry.
+ In other case the defualt QGraphicsView::mouseMoveEvent implementation is called.
+*/
+void QChartView::mouseMoveEvent(QMouseEvent *event)
+{
+ if(d_ptr->m_rubberBand && d_ptr->m_rubberBand->isVisible()) {
+ QRectF margins = d_ptr->m_chart->margins();
+ QRectF geometry = d_ptr->m_chart->geometry();
+ QRectF rect =geometry.adjusted(margins.left(),margins.top(),-margins.right(),-margins.bottom());
+ int width = event->pos().x() - d_ptr->m_rubberBandOrigin.x();
+ int height = event->pos().y() - d_ptr->m_rubberBandOrigin.y();
+ if (!d_ptr->m_rubberBandFlags.testFlag(VerticalRubberBand)) {
+ d_ptr->m_rubberBandOrigin.setY(rect.top());
+ height = rect.height();
+ }
+ if (!d_ptr->m_rubberBandFlags.testFlag(HorizonalRubberBand)) {
+ d_ptr->m_rubberBandOrigin.setX(rect.left());
+ width= rect.width();
+ }
+ d_ptr->m_rubberBand->setGeometry(QRect(d_ptr->m_rubberBandOrigin.x(),d_ptr->m_rubberBandOrigin.y(), width,height).normalized());
+ }
+ else {
+ QGraphicsView::mouseMoveEvent(event);
+ }
+}
+
+/*!
+ If left mouse button is release and RubberBand is enabled then \a event is accepted and the view is zoomed in to rect specified by RubberBand
+ If it is the right mouse button \a event then RubberBand is dissmissed and zoom is canceled.
+*/
+void QChartView::mouseReleaseEvent(QMouseEvent *event)
+{
+ if(d_ptr->m_rubberBand) {
+ if (event->button() == Qt::LeftButton && d_ptr->m_rubberBand->isVisible()) {
+ d_ptr->m_rubberBand->hide();
+ QRect rect = d_ptr->m_rubberBand->geometry();
+ d_ptr->m_chart->zoomIn(rect);
+ event->accept();
+ }
+
+ if(event->button()==Qt::RightButton){
+ d_ptr->m_chart->zoomOut();
+ event->accept();
+ }
+ }
+ else {
+ QGraphicsView::mouseReleaseEvent(event);
+ }
+}
+
+/*!
+ Resizes and updates the chart area using the \a event data
+*/
+void QChartView::resizeEvent(QResizeEvent *event)
+{
+ QGraphicsView::resizeEvent(event);
+ d_ptr->m_chart->resize(size());
+ setMinimumSize(d_ptr->m_chart->minimumSize().toSize());
+ setSceneRect(d_ptr->m_chart->geometry());
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QChartViewPrivate::QChartViewPrivate():
+m_scene(0),
+m_chart(0),
+m_presenter(0),
+m_rubberBand(0),
+m_rubberBandFlags(QChartView::NoRubberBand)
+{
+
+}
+
+QChartViewPrivate::~QChartViewPrivate()
+{
+
+}
+
+#include "moc_qchartview.cpp"
+
+QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/qchartview_p.h b/src/qchartview_p.h
index f1a2bc3e..cabc2884 100644
--- a/src/qchartview_p.h
+++ b/src/qchartview_p.h
@@ -33,6 +33,7 @@
#include "qchartview.h"
class QGraphicsScene;
+class ChartPresenter;
QTCOMMERCIALCHART_BEGIN_NAMESPACE
diff --git a/src/qseries_p.h b/src/qseries_p.h
index ad20c0a7..55ebc122 100644
--- a/src/qseries_p.h
+++ b/src/qseries_p.h
@@ -27,8 +27,8 @@
//
// We mean it.
-#ifndef QSERIES_P_H_
-#define QSERIES_P_H_
+#ifndef QSERIES_P_H
+#define QSERIES_P_H
#include "qseries.h"
diff --git a/src/scatterseries/qscatterseries_p.h b/src/scatterseries/qscatterseries_p.h
index 635b3124..3c79d44b 100644
--- a/src/scatterseries/qscatterseries_p.h
+++ b/src/scatterseries/qscatterseries_p.h
@@ -27,8 +27,8 @@
//
// We mean it.
-#ifndef QSCATTERSERIES_P_H_
-#define QSCATTERSERIES_P_H_
+#ifndef QSCATTERSERIES_P_H
+#define QSCATTERSERIES_P_H
#include "qxyseries_p.h"
diff --git a/src/scatterseries/scatterchartitem_p.h b/src/scatterseries/scatterchartitem_p.h
index 7dc2cfff..b1b95b53 100644
--- a/src/scatterseries/scatterchartitem_p.h
+++ b/src/scatterseries/scatterchartitem_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef SCATTERPRESENTER_H
-#define SCATTERPRESENTER_H
+#ifndef SCATTERCHARTITEM_H
+#define SCATTERCHARTITEM_H
#include "qchartglobal.h"
#include "xychartitem_p.h"
diff --git a/src/scroller_p.h b/src/scroller_p.h
index 0cac15a4..79fcf2e0 100644
--- a/src/scroller_p.h
+++ b/src/scroller_p.h
@@ -27,8 +27,8 @@
//
// We mean it.
-#ifndef SCROLLER_P_H_
-#define SCROLLER_P_H_
+#ifndef SCROLLER_P_H
+#define SCROLLER_P_H
#include "qchartglobal.h"
#include <QBasicTimer>
diff --git a/src/splinechart/qsplineseries_p.h b/src/splinechart/qsplineseries_p.h
index d2180cf4..a22caaa9 100644
--- a/src/splinechart/qsplineseries_p.h
+++ b/src/splinechart/qsplineseries_p.h
@@ -27,8 +27,8 @@
//
// We mean it.
-#ifndef QSPLINESERIES_P_H_
-#define QSPLINESERIES_P_H_
+#ifndef QSPLINESERIES_P_H
+#define QSPLINESERIES_P_H
#include "qlineseries_p.h"
diff --git a/src/themes/chartthemeblueicy_p.h b/src/themes/chartthemeblueicy_p.h
index 32acd902..3a75acb6 100644
--- a/src/themes/chartthemeblueicy_p.h
+++ b/src/themes/chartthemeblueicy_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef CHARTTHEMEBLUECEICY_P_H
-#define CHARTTHEMEBLUECEICY_P_H
+#ifndef CHARTTHEMEBLUEICY_P_H
+#define CHARTTHEMEBLUEICY_P_H
#include "charttheme_p.h"
diff --git a/src/themes/chartthemelight_p.h b/src/themes/chartthemelight_p.h
index a3e49f2a..bbbe9229 100644
--- a/src/themes/chartthemelight_p.h
+++ b/src/themes/chartthemelight_p.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef CHARTTHEMEHIGHLIGHT_P_H
-#define CHARTTHEMEHIGHLIGHT_P_H
+#ifndef CHARTTHEMELIGHT_P_H
+#define CHARTTHEMELIGHT_P_H
#include "charttheme_p.h"
diff --git a/src/xychart/qxyseries.h b/src/xychart/qxyseries.h
index 717f8f9a..4af35453 100644
--- a/src/xychart/qxyseries.h
+++ b/src/xychart/qxyseries.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef QXYSERIES_H_
-#define QXYSERIES_H_
+#ifndef QXYSERIES_H
+#define QXYSERIES_H
#include <qchartglobal.h>
#include <qseries.h>
diff --git a/src/xychart/qxyseries_p.h b/src/xychart/qxyseries_p.h
index c7e00773..deb9b01a 100644
--- a/src/xychart/qxyseries_p.h
+++ b/src/xychart/qxyseries_p.h
@@ -27,8 +27,8 @@
//
// We mean it.
-#ifndef QXYSERIES_P_H_
-#define QXYSERIES_P_H_
+#ifndef QXYSERIES_P_H
+#define QXYSERIES_P_H
#include "qseries_p.h"