From 6b65c67e374559963b056e0d5fa3c7862254d6fc 2012-03-13 13:28:50 From: Michal Klocek Date: 2012-03-13 13:28:50 Subject: [PATCH] Unify naming setGeometry -> setLayout --- diff --git a/src/animations/xyanimation.cpp b/src/animations/xyanimation.cpp index a947ea2..a9a919d 100644 --- a/src/animations/xyanimation.cpp +++ b/src/animations/xyanimation.cpp @@ -82,7 +82,7 @@ void XYAnimation::updateCurrentValue (const QVariant & value ) { if(state()!=QAbstractAnimation::Stopped){ //workaround QVector vector = qVariantValue >(value); - m_item->setGeometry(vector); + m_item->setLayout(vector); } } diff --git a/src/areachart/areachartitem.cpp b/src/areachart/areachartitem.cpp index c3e6aa0..036c996 100644 --- a/src/areachart/areachartitem.cpp +++ b/src/areachart/areachartitem.cpp @@ -40,16 +40,6 @@ QPainterPath AreaChartItem::shape() const return m_path; } -void AreaChartItem::setPen(const QPen& pen) -{ - m_pen = pen; -} - -void AreaChartItem::setBrush(const QBrush& brush) -{ - m_brush = brush; -} - void AreaChartItem::updatePath() { QPainterPath path; @@ -73,8 +63,8 @@ void AreaChartItem::updatePath() void AreaChartItem::handleUpdated() { - setPen(m_series->pen()); - setBrush(m_series->brush()); + m_pen = m_series->pen(); + m_brush = m_series->brush(); update(); } diff --git a/src/areachart/areachartitem_p.h b/src/areachart/areachartitem_p.h index 97c1783..4c6bc3f 100644 --- a/src/areachart/areachartitem_p.h +++ b/src/areachart/areachartitem_p.h @@ -22,8 +22,6 @@ public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); QPainterPath shape() const; - void setPen(const QPen& pen); - void setBrush(const QBrush& brush); void setPointsVisible(bool visible); void updatePath(); public slots: @@ -50,8 +48,8 @@ public: ~AreaBoundItem(){}; - void setGeometry(QVector& points){ - LineChartItem::setGeometry(points); + void setLayout(QVector& points){ + LineChartItem::setLayout(points); m_item->updatePath(); } diff --git a/src/charttheme.cpp b/src/charttheme.cpp index aa11b42..0a173a9 100644 --- a/src/charttheme.cpp +++ b/src/charttheme.cpp @@ -77,18 +77,14 @@ void ChartTheme::decorate(AreaChartItem* item, QAreaSeries* series, int index) QBrush brush; if (pen != series->pen()){ - item->setPen(series->pen()); - } else { pen.setColor(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1.0)); pen.setWidthF(2); - item->setPen(pen); + series->setPen(pen); } if (brush != series->brush()) { - item->setBrush(series->brush()); - } else { QBrush brush(m_seriesColors.at(index % m_seriesColors.size())); - item->setBrush(brush); + series->setBrush(brush); } } diff --git a/src/linechart/linechartitem.cpp b/src/linechart/linechartitem.cpp index 87ef527..8bb22b6 100644 --- a/src/linechart/linechartitem.cpp +++ b/src/linechart/linechartitem.cpp @@ -29,11 +29,11 @@ QPainterPath LineChartItem::shape() const return m_path; } -void LineChartItem::setGeometry(QVector& points) +void LineChartItem::setLayout(QVector& points) { if(points.size()==0) { - XYChartItem::setGeometry(points); + XYChartItem::setLayout(points); return; } @@ -49,7 +49,7 @@ void LineChartItem::setGeometry(QVector& points) m_path = linePath; m_rect = linePath.boundingRect(); - XYChartItem::setGeometry(points); + XYChartItem::setLayout(points); } void LineChartItem::handleUpdated() diff --git a/src/linechart/linechartitem_p.h b/src/linechart/linechartitem_p.h index 3026f42..ce0c1f7 100644 --- a/src/linechart/linechartitem_p.h +++ b/src/linechart/linechartitem_p.h @@ -28,7 +28,7 @@ signals: void clicked(const QPointF& point); protected: - virtual void setGeometry(QVector& points); + void setLayout(QVector& points); void mousePressEvent( QGraphicsSceneMouseEvent * event ); private: diff --git a/src/scatterseries/scatterchartitem.cpp b/src/scatterseries/scatterchartitem.cpp index 07d91ef..5ca96d0 100644 --- a/src/scatterseries/scatterchartitem.cpp +++ b/src/scatterseries/scatterchartitem.cpp @@ -90,11 +90,11 @@ void ScatterChartItem::markerSelected(Marker* marker) emit clicked(QPointF(m_series->x(marker->index()), m_series->y(marker->index()))); } -void ScatterChartItem::setGeometry(QVector& points) +void ScatterChartItem::setLayout(QVector& points) { if(points.size()==0) { - XYChartItem::setGeometry(points); + XYChartItem::setLayout(points); return; } @@ -127,7 +127,7 @@ void ScatterChartItem::setGeometry(QVector& points) prepareGeometryChange(); m_rect = clipRect(); - XYChartItem::setGeometry(points); + XYChartItem::setLayout(points); } diff --git a/src/scatterseries/scatterchartitem_p.h b/src/scatterseries/scatterchartitem_p.h index 5e156ee..06dd2d0 100644 --- a/src/scatterseries/scatterchartitem_p.h +++ b/src/scatterseries/scatterchartitem_p.h @@ -38,7 +38,7 @@ private: void deletePoints(int count); protected: - virtual void setGeometry(QVector& points); + void setLayout(QVector& points); private: QScatterSeries *m_series; diff --git a/src/splinechart/splinechartitem.cpp b/src/splinechart/splinechartitem.cpp index 06ee33a..2d565ee 100644 --- a/src/splinechart/splinechartitem.cpp +++ b/src/splinechart/splinechartitem.cpp @@ -28,12 +28,12 @@ QPointF SplineChartItem::calculateGeometryControlPoint(int index) const return XYChartItem::calculateGeometryPoint(m_series->controlPoint(index)); } -void SplineChartItem::setGeometry(QVector& points) +void SplineChartItem::setLayout(QVector& points) { if(points.size()==0) { - XYChartItem::setGeometry(points); + XYChartItem::setLayout(points); return; } @@ -50,7 +50,7 @@ void SplineChartItem::setGeometry(QVector& points) prepareGeometryChange(); m_path = splinePath; m_rect = splinePath.boundingRect(); - XYChartItem::setGeometry(points); + XYChartItem::setLayout(points); } void SplineChartItem::setLinePen(const QPen& pen) diff --git a/src/splinechart/splinechartitem_p.h b/src/splinechart/splinechartitem_p.h index 7a4e44d..f043555 100644 --- a/src/splinechart/splinechartitem_p.h +++ b/src/splinechart/splinechartitem_p.h @@ -25,7 +25,7 @@ public slots: void handleUpdated(); protected: - void setGeometry(QVector& points); + void setLayout(QVector& points); private: QPointF calculateGeometryControlPoint(int index) const; diff --git a/src/xychart/xychartitem.cpp b/src/xychart/xychartitem.cpp index 9a46d0b..531917c 100644 --- a/src/xychart/xychartitem.cpp +++ b/src/xychart/xychartitem.cpp @@ -65,21 +65,21 @@ QPointF XYChartItem::calculateDomainPoint(const QPointF& point) const return QPointF(x,y); } -void XYChartItem::updatePoints(QVector& points) +void XYChartItem::applyLayout(QVector& points) { if(m_animator){ m_animator->applyLayout(this,points); } - else setGeometry(points); + else setLayout(points); } -void XYChartItem::updatePoint(QVector& points) +void XYChartItem::updateLayout(QVector& points) { - setGeometry(points); + setLayout(points); } -void XYChartItem::setGeometry(QVector& points) +void XYChartItem::setLayout(QVector& points) { m_points = points; } @@ -94,7 +94,7 @@ void XYChartItem::handlePointAdded(int index) QPointF point = calculateGeometryPoint(index); QVector points = m_points; points.insert(index,point); - updatePoints(points); + updateLayout(points); update(); } void XYChartItem::handlePointRemoved(int index) @@ -104,7 +104,7 @@ void XYChartItem::handlePointRemoved(int index) // QPointF point = calculateGeometryPoint(index); QVector points = m_points; points.remove(index); - updatePoints(points); + updateLayout(points); update(); } @@ -115,7 +115,7 @@ void XYChartItem::handlePointReplaced(int index) QPointF point = calculateGeometryPoint(index); QVector points = m_points; points.replace(index,point); - updatePoint(points); + updateLayout(points); update(); } @@ -128,7 +128,7 @@ void XYChartItem::handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal if(isEmpty()) return; QVector points = calculateGeometryPoints(); - updatePoints(points); + applyLayout(points); update(); } @@ -141,7 +141,7 @@ void XYChartItem::handleGeometryChanged(const QRectF& rect) if(isEmpty()) return; QVector points = calculateGeometryPoints(); - updatePoints(points); + applyLayout(points); update(); } diff --git a/src/xychart/xychartitem_p.h b/src/xychart/xychartitem_p.h index a3eb83c..beaefcc 100644 --- a/src/xychart/xychartitem_p.h +++ b/src/xychart/xychartitem_p.h @@ -28,15 +28,15 @@ public slots: void handleGeometryChanged(const QRectF& size); protected: - virtual void setGeometry(QVector& points); + virtual void setLayout(QVector& points); QPointF calculateGeometryPoint(const QPointF& point) const; QPointF calculateGeometryPoint(int index) const; QPointF calculateDomainPoint(const QPointF& point) const; QVector calculateGeometryPoints() const; private: - void updatePoints(QVector& points); - void updatePoint(QVector& points); + void applyLayout(QVector& points); + void updateLayout(QVector& points); inline bool isEmpty(); private: