diff --git a/src/animations/chartanimator.cpp b/src/animations/chartanimator.cpp index c49cd2a..6a16e6a 100644 --- a/src/animations/chartanimator.cpp +++ b/src/animations/chartanimator.cpp @@ -22,7 +22,7 @@ #include "axisanimation_p.h" #include "xyanimation_p.h" #include "splineanimation_p.h" -#include "xychartitem_p.h" +#include "xychart_p.h" #include "pieanimation_p.h" #include "baranimation_p.h" #include "barchartitem_p.h" diff --git a/src/animations/xyanimation.cpp b/src/animations/xyanimation.cpp index 8eedc2a..368cda7 100644 --- a/src/animations/xyanimation.cpp +++ b/src/animations/xyanimation.cpp @@ -19,14 +19,14 @@ ****************************************************************************/ #include "xyanimation_p.h" -#include "xychartitem_p.h" +#include "xychart_p.h" #include Q_DECLARE_METATYPE(QVector) QTCOMMERCIALCHART_BEGIN_NAMESPACE -XYAnimation::XYAnimation(XYChartItem *item):ChartAnimation(item), +XYAnimation::XYAnimation(XYChart *item):ChartAnimation(item), m_item(item), m_dirty(false), m_type(MoveDownAnimation) diff --git a/src/animations/xyanimation_p.h b/src/animations/xyanimation_p.h index d7b987a..92d644f 100644 --- a/src/animations/xyanimation_p.h +++ b/src/animations/xyanimation_p.h @@ -26,13 +26,13 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -class XYChartItem; +class XYChart; class XYAnimation : public ChartAnimation { public: enum Animation { LineDrawAnimation, MoveDownAnimation, MoveUpAnimation }; - XYAnimation(XYChartItem *item); + XYAnimation(XYChart *item); ~XYAnimation(); void setValues(QVector &oldPoints, QVector &newPoints,int index); void setAnimationType(Animation type); @@ -43,7 +43,7 @@ protected: void updateCurrentValue (const QVariant &value ); private: - XYChartItem *m_item; + XYChart *m_item; QVector m_oldPoints; bool m_dirty; Animation m_type; diff --git a/src/linechart/linechartitem.cpp b/src/linechart/linechartitem.cpp index 2951d63..9ead231 100644 --- a/src/linechart/linechartitem.cpp +++ b/src/linechart/linechartitem.cpp @@ -23,13 +23,15 @@ #include "qlineseries_p.h" #include "chartpresenter_p.h" #include +#include QTCOMMERCIALCHART_BEGIN_NAMESPACE //TODO: optimize : remove points which are not visible -LineChartItem::LineChartItem(QLineSeries* series,ChartPresenter *presenter):XYChartItem(series,presenter), +LineChartItem::LineChartItem(QLineSeries* series,ChartPresenter *presenter):XYChart(series,presenter), +QGraphicsItem(presenter ? presenter->rootItem() : 0), m_series(series), m_pointsVisible(false) { @@ -67,6 +69,7 @@ void LineChartItem::updateGeometry() prepareGeometryChange(); m_path = linePath; m_rect = linePath.boundingRect(); + setPos(origin()); } void LineChartItem::handleUpdated() @@ -96,6 +99,11 @@ void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt painter->restore(); } +void LineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + emit XYChart::clicked(calculateDomainPoint(event->pos())); +} + #include "moc_linechartitem_p.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/linechart/linechartitem_p.h b/src/linechart/linechartitem_p.h index fe8c167..87b07a3 100644 --- a/src/linechart/linechartitem_p.h +++ b/src/linechart/linechartitem_p.h @@ -22,7 +22,7 @@ #define LINECHARTITEM_H #include "qchartglobal.h" -#include "xychartitem_p.h" +#include "xychart_p.h" #include QTCOMMERCIALCHART_BEGIN_NAMESPACE @@ -30,9 +30,10 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE class QLineSeries; class ChartPresenter; -class LineChartItem : public XYChartItem +class LineChartItem : public XYChart , public QGraphicsItem { Q_OBJECT + Q_INTERFACES(QGraphicsItem) public: explicit LineChartItem(QLineSeries *series,ChartPresenter *presenter); ~LineChartItem() {}; @@ -46,6 +47,7 @@ public Q_SLOTS: void handleUpdated(); protected: void updateGeometry(); + void mousePressEvent(QGraphicsSceneMouseEvent *event); private: QLineSeries* m_series; diff --git a/src/scatterchart/scatterchartitem.cpp b/src/scatterchart/scatterchartitem.cpp index b4d9a9f..59721c4 100644 --- a/src/scatterchart/scatterchartitem.cpp +++ b/src/scatterchart/scatterchartitem.cpp @@ -1,22 +1,22 @@ /**************************************************************************** -** -** 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 "scatterchartitem_p.h" #include "qscatterseries.h" @@ -25,16 +25,17 @@ #include #include #include +#include QTCOMMERCIALCHART_BEGIN_NAMESPACE ScatterChartItem::ScatterChartItem(QScatterSeries *series, ChartPresenter *presenter) : - XYChartItem(series,presenter), - m_series(series), - m_items(this), - m_shape(QScatterSeries::MarkerShapeRectangle), - m_size(15) - +XYChart(series,presenter), +QGraphicsItem(presenter ? presenter->rootItem() : 0), +m_series(series), +m_items(this), +m_shape(QScatterSeries::MarkerShapeRectangle), +m_size(15) { QObject::connect(m_series->d_func(),SIGNAL(updated()), this, SLOT(handleUpdated())); @@ -52,7 +53,6 @@ ScatterChartItem::ScatterChartItem(QScatterSeries *series, ChartPresenter *prese // setGraphicsEffect(dropShadow); } - QRectF ScatterChartItem::boundingRect() const { return m_rect; @@ -65,22 +65,22 @@ void ScatterChartItem::createPoints(int count) QGraphicsItem *item = 0; switch (m_shape) { - case QScatterSeries::MarkerShapeCircle:{ - QGraphicsEllipseItem* i = new QGraphicsEllipseItem(0,0,m_size,m_size); - const QRectF& rect = i->boundingRect(); - i->setPos(-rect.width()/2,-rect.height()/2); - item = new Marker(i,this); - break; - } - case QScatterSeries::MarkerShapeRectangle:{ - QGraphicsRectItem* i = new QGraphicsRectItem(0,0,m_size,m_size); - i->setPos(-m_size/2,-m_size/2); - item = new Marker(i,this); - break; - } - default: - qWarning()<<"Unsupported marker type"; - break; + case QScatterSeries::MarkerShapeCircle: { + QGraphicsEllipseItem* i = new QGraphicsEllipseItem(0,0,m_size,m_size); + const QRectF& rect = i->boundingRect(); + i->setPos(-rect.width()/2,-rect.height()/2); + item = new Marker(i,this); + break; + } + case QScatterSeries::MarkerShapeRectangle: { + QGraphicsRectItem* i = new QGraphicsRectItem(0,0,m_size,m_size); + i->setPos(-m_size/2,-m_size/2); + item = new Marker(i,this); + break; + } + default: + qWarning()<<"Unsupported marker type"; + break; } m_items.addToGroup(item); @@ -98,7 +98,7 @@ void ScatterChartItem::deletePoints(int count) void ScatterChartItem::markerSelected(Marker *marker) { - emit XYChartItem::clicked(marker->point()); + emit XYChart::clicked(marker->point()); } void ScatterChartItem::updateGeometry() @@ -141,9 +141,9 @@ void ScatterChartItem::updateGeometry() prepareGeometryChange(); m_rect = clipRect(); + setPos(origin()); } - void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(painter) @@ -154,15 +154,15 @@ void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * void ScatterChartItem::setPen(const QPen& pen) { foreach(QGraphicsItem* item , m_items.childItems()) { - static_cast(item)->setPen(pen); + static_cast(item)->setPen(pen); } } void ScatterChartItem::setBrush(const QBrush& brush) { foreach(QGraphicsItem* item , m_items.childItems()) { - static_cast(item)->setBrush(brush); - } + static_cast(item)->setBrush(brush); + } } void ScatterChartItem::handleUpdated() @@ -179,7 +179,7 @@ void ScatterChartItem::handleUpdated() m_size = m_series->size(); m_shape = m_series->shape(); - if(recreate){ + if(recreate) { deletePoints(count); createPoints(count); } @@ -188,6 +188,11 @@ void ScatterChartItem::handleUpdated() setBrush(m_series->brush()); } +void ScatterChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + emit XYChart::clicked(calculateDomainPoint(event->pos())); +} + #include "moc_scatterchartitem_p.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/scatterchart/scatterchartitem_p.h b/src/scatterchart/scatterchartitem_p.h index 96c4ee3..e29ce5f 100644 --- a/src/scatterchart/scatterchartitem_p.h +++ b/src/scatterchart/scatterchartitem_p.h @@ -22,7 +22,7 @@ #define SCATTERCHARTITEM_H #include "qchartglobal.h" -#include "xychartitem_p.h" +#include "xychart_p.h" #include #include @@ -31,7 +31,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE class QScatterSeries; class Marker; -class ScatterChartItem : public XYChartItem +class ScatterChartItem : public XYChart, public QGraphicsItem { Q_OBJECT public: @@ -56,6 +56,7 @@ private: protected: void updateGeometry(); + void mousePressEvent(QGraphicsSceneMouseEvent *event); private: QScatterSeries *m_series; diff --git a/src/splinechart/splinechartitem.cpp b/src/splinechart/splinechartitem.cpp index c40bd95..20997a7 100644 --- a/src/splinechart/splinechartitem.cpp +++ b/src/splinechart/splinechartitem.cpp @@ -1,37 +1,38 @@ /**************************************************************************** -** -** 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 "splinechartitem_p.h" #include "qsplineseries_p.h" #include "chartpresenter_p.h" #include "chartanimator_p.h" #include -#include +#include QTCOMMERCIALCHART_BEGIN_NAMESPACE SplineChartItem::SplineChartItem(QSplineSeries *series, ChartPresenter *presenter) : - XYChartItem(series, presenter), - m_series(series), - m_pointsVisible(false), - m_animation(0) +XYChart(series, presenter), +QGraphicsItem(presenter ? presenter->rootItem() : 0), +m_series(series), +m_pointsVisible(false), +m_animation(0) { setZValue(ChartPresenter::LineChartZValue); QObject::connect(m_series->d_func(),SIGNAL(updated()),this,SLOT(handleUpdated())); @@ -51,7 +52,7 @@ QPainterPath SplineChartItem::shape() const void SplineChartItem::setAnimation(SplineAnimation* animation) { m_animation=animation; - XYChartItem::setAnimation(animation); + XYChart::setAnimation(animation); } void SplineChartItem::setControlGeometryPoints(QVector& points) @@ -97,7 +98,7 @@ void SplineChartItem::updateChart(QVector &oldPoints, QVector QPointF SplineChartItem::calculateGeometryControlPoint(int index) const { - return XYChartItem::calculateGeometryPoint(m_series->d_func()->controlPoint(index)); + return XYChart::calculateGeometryPoint(m_series->d_func()->controlPoint(index)); } void SplineChartItem::updateGeometry() @@ -122,6 +123,7 @@ void SplineChartItem::updateGeometry() prepareGeometryChange(); m_path = splinePath; m_rect = splinePath.boundingRect(); + setPos(origin()); } //handlers @@ -152,7 +154,10 @@ void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o painter->restore(); } - +void SplineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + emit XYChart::clicked(calculateDomainPoint(event->pos())); +} #include "moc_splinechartitem_p.cpp" diff --git a/src/splinechart/splinechartitem_p.h b/src/splinechart/splinechartitem_p.h index f9f9c0d..886738f 100644 --- a/src/splinechart/splinechartitem_p.h +++ b/src/splinechart/splinechartitem_p.h @@ -22,14 +22,15 @@ #define SPLINECHARTITEM_P_H #include "qsplineseries.h" -#include "xychartitem_p.h" +#include "xychart_p.h" #include "splineanimation_p.h" QTCOMMERCIALCHART_BEGIN_NAMESPACE -class SplineChartItem : public XYChartItem +class SplineChartItem : public XYChart, public QGraphicsItem { Q_OBJECT + Q_INTERFACES(QGraphicsItem) public: SplineChartItem(QSplineSeries *series, ChartPresenter *presenter); @@ -50,6 +51,7 @@ public Q_SLOTS: protected: void updateGeometry(); void updateChart(QVector &oldPoints, QVector &newPoints,int index); + void mousePressEvent(QGraphicsSceneMouseEvent *event); private: QPointF calculateGeometryControlPoint(int index) const; diff --git a/src/xychart/qxyseries.h b/src/xychart/qxyseries.h index 0f2cc94..a02f8d6 100644 --- a/src/xychart/qxyseries.h +++ b/src/xychart/qxyseries.h @@ -78,7 +78,7 @@ private: Q_DECLARE_PRIVATE(QXYSeries); Q_DISABLE_COPY(QXYSeries); friend class XYLegendMarker; - friend class XYChartItem; + friend class XYChart; }; QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/xychart/xychartitem.cpp b/src/xychart/xychart.cpp similarity index 76% rename from src/xychart/xychartitem.cpp rename to src/xychart/xychart.cpp index d117462..4f00e7d 100644 --- a/src/xychart/xychartitem.cpp +++ b/src/xychart/xychart.cpp @@ -18,22 +18,20 @@ ** ****************************************************************************/ -#include "xychartitem_p.h" +#include "xychart_p.h" #include "qxyseries.h" #include "qxyseries_p.h" #include "chartpresenter_p.h" #include "chartanimator_p.h" #include -#include #include #include "qxymodelmapper.h" -#include QTCOMMERCIALCHART_BEGIN_NAMESPACE //TODO: optimize : remove points which are not visible -XYChartItem::XYChartItem(QXYSeries *series, ChartPresenter *presenter):ChartItem(presenter), +XYChart::XYChart(QXYSeries *series, ChartPresenter *presenter):Chart(presenter), m_minX(0), m_maxX(0), m_minY(0), @@ -50,22 +48,22 @@ m_animation(0) QObject::connect(this,SIGNAL(clicked(QPointF)),series,SIGNAL(clicked(QPointF))); } -void XYChartItem::setGeometryPoints(QVector& points) +void XYChart::setGeometryPoints(QVector& points) { m_points = points; } -void XYChartItem::setClipRect(const QRectF &rect) +void XYChart::setClipRect(const QRectF &rect) { m_clipRect = rect; } -void XYChartItem::setAnimation(XYAnimation* animation) +void XYChart::setAnimation(XYAnimation* animation) { m_animation=animation; } -QPointF XYChartItem::calculateGeometryPoint(const QPointF &point) const +QPointF XYChart::calculateGeometryPoint(const QPointF &point) const { const qreal deltaX = m_size.width()/(m_maxX-m_minX); const qreal deltaY = m_size.height()/(m_maxY-m_minY); @@ -74,7 +72,7 @@ QPointF XYChartItem::calculateGeometryPoint(const QPointF &point) const return QPointF(x,y); } -QPointF XYChartItem::calculateGeometryPoint(int index) const +QPointF XYChart::calculateGeometryPoint(int index) const { const qreal deltaX = m_size.width()/(m_maxX-m_minX); const qreal deltaY = m_size.height()/(m_maxY-m_minY); @@ -84,7 +82,7 @@ QPointF XYChartItem::calculateGeometryPoint(int index) const return QPointF(x,y); } -QVector XYChartItem::calculateGeometryPoints() const +QVector XYChart::calculateGeometryPoints() const { const qreal deltaX = m_size.width()/(m_maxX-m_minX); const qreal deltaY = m_size.height()/(m_maxY-m_minY); @@ -101,7 +99,7 @@ QVector XYChartItem::calculateGeometryPoints() const return result; } -QPointF XYChartItem::calculateDomainPoint(const QPointF &point) const +QPointF XYChart::calculateDomainPoint(const QPointF &point) const { const qreal deltaX = m_size.width()/(m_maxX-m_minX); const qreal deltaY = m_size.height()/(m_maxY-m_minY); @@ -110,7 +108,7 @@ QPointF XYChartItem::calculateDomainPoint(const QPointF &point) const return QPointF(x,y); } -void XYChartItem::updateChart(QVector &oldPoints, QVector &newPoints,int index) +void XYChart::updateChart(QVector &oldPoints, QVector &newPoints,int index) { if (m_animation) { m_animation->setValues(oldPoints, newPoints, index); @@ -122,13 +120,9 @@ void XYChartItem::updateChart(QVector &oldPoints, QVector &new } } -void XYChartItem::updateGeometry() -{ - update(); -} //handlers -void XYChartItem::handlePointAdded(int index) +void XYChart::handlePointAdded(int index) { if (m_series->model() == 0) { Q_ASSERT(indexcount()); @@ -147,7 +141,7 @@ void XYChartItem::handlePointAdded(int index) updateChart(m_points,points,index); } -void XYChartItem::handlePointsAdded(int start, int end) +void XYChart::handlePointsAdded(int start, int end) { if (m_series->model() == 0) { for (int i = start; i <= end; i++) @@ -177,7 +171,7 @@ void XYChartItem::handlePointsAdded(int start, int end) } } -void XYChartItem::handlePointRemoved(int index) +void XYChart::handlePointRemoved(int index) { if (m_series->model() == 0) { Q_ASSERT(indexcount() + 1); @@ -193,7 +187,7 @@ void XYChartItem::handlePointRemoved(int index) updateChart(m_points,points,index); } -void XYChartItem::handlePointsRemoved(int start, int end) +void XYChart::handlePointsRemoved(int start, int end) { Q_UNUSED(start) Q_UNUSED(end) @@ -244,7 +238,7 @@ void XYChartItem::handlePointsRemoved(int start, int end) } -void XYChartItem::handlePointReplaced(int index) +void XYChart::handlePointReplaced(int index) { Q_ASSERT(indexcount()); Q_ASSERT(index>=0); @@ -259,7 +253,7 @@ void XYChartItem::handlePointReplaced(int index) updateChart(m_points,points,index); } -void XYChartItem::handleReinitialized() +void XYChart::handleReinitialized() { QVector points = calculateGeometryPoints(); @@ -270,7 +264,7 @@ void XYChartItem::handleReinitialized() updateChart(m_points,points); } -void XYChartItem::handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY) +void XYChart::handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY) { m_minX=minX; m_maxX=maxX; @@ -285,12 +279,12 @@ void XYChartItem::handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal updateChart(m_points,points); } -void XYChartItem::handleGeometryChanged(const QRectF &rect) +void XYChart::handleGeometryChanged(const QRectF &rect) { Q_ASSERT(rect.isValid()); m_size=rect.size(); m_clipRect=rect.translated(-rect.topLeft()); - setPos(rect.topLeft()); + m_origin=rect.topLeft(); if (isEmpty()) return; QVector points = calculateGeometryPoints(); @@ -300,16 +294,11 @@ void XYChartItem::handleGeometryChanged(const QRectF &rect) updateChart(m_points,points); } -bool XYChartItem::isEmpty() +bool XYChart::isEmpty() { return !m_clipRect.isValid() || qFuzzyIsNull(m_maxX - m_minX) || qFuzzyIsNull(m_maxY - m_minY) || m_series->points().isEmpty(); } -void XYChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - emit clicked(calculateDomainPoint(event->pos())); -} - -#include "moc_xychartitem_p.cpp" +#include "moc_xychart_p.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/xychart/xychart.pri b/src/xychart/xychart.pri index 5753f5e..8913527 100644 --- a/src/xychart/xychart.pri +++ b/src/xychart/xychart.pri @@ -2,12 +2,12 @@ INCLUDEPATH += $$PWD DEPENDPATH += $$PWD SOURCES += \ - $$PWD/xychartitem.cpp \ + $$PWD/xychart.cpp \ $$PWD/qxyseries.cpp \ $$PWD/qxymodelmapper.cpp PRIVATE_HEADERS += \ - $$PWD/xychartitem_p.h \ + $$PWD/xychart_p.h \ $$PWD/qxyseries_p.h diff --git a/src/xychart/xychartitem_p.h b/src/xychart/xychart_p.h similarity index 92% rename from src/xychart/xychartitem_p.h rename to src/xychart/xychart_p.h index 42b5111..7127c5a 100644 --- a/src/xychart/xychartitem_p.h +++ b/src/xychart/xychart_p.h @@ -31,12 +31,12 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE class ChartPresenter; class QXYSeries; -class XYChartItem : public ChartItem +class XYChart : public Chart { Q_OBJECT public: - explicit XYChartItem(QXYSeries *series, ChartPresenter *presenter); - ~XYChartItem(){}; + explicit XYChart(QXYSeries *series, ChartPresenter *presenter); + ~XYChart(){}; void setGeometryPoints(QVector& points); QVector geometryPoints() const { return m_points; } @@ -44,9 +44,12 @@ public: void setClipRect(const QRectF &rect); QRectF clipRect() const { return m_clipRect; } + QSizeF size() const { return m_size; } + QPointF origin() const { return m_origin; } + void setAnimation(XYAnimation* animation); ChartAnimation* animation() const { return m_animation; } - virtual void updateGeometry(); + virtual void updateGeometry() = 0; public Q_SLOTS: void handlePointAdded(int index); @@ -67,7 +70,6 @@ protected: QPointF calculateGeometryPoint(int index) const; QPointF calculateDomainPoint(const QPointF &point) const; QVector calculateGeometryPoints() const; - void mousePressEvent(QGraphicsSceneMouseEvent *event); private: inline bool isEmpty(); @@ -79,6 +81,7 @@ private: qreal m_maxY; QXYSeries* m_series; QSizeF m_size; + QPointF m_origin; QRectF m_clipRect; QVector m_points; XYAnimation* m_animation;