@@ -110,11 +110,17 void AreaChartItem::updatePath() | |||||
110 | } |
|
110 | } | |
111 | } |
|
111 | } | |
112 | path.closeSubpath(); |
|
112 | path.closeSubpath(); | |
|
113 | ||||
|
114 | // Only zoom in if the bounding rect of the path fits inside int limits. QWidget::update() uses | |||
|
115 | // a region that has to be compatible with QRect. | |||
|
116 | if (path.boundingRect().height() <= INT_MAX | |||
|
117 | && path.boundingRect().width() <= INT_MAX) { | |||
113 | prepareGeometryChange(); |
|
118 | prepareGeometryChange(); | |
114 | m_path = path; |
|
119 | m_path = path; | |
115 | m_rect = path.boundingRect(); |
|
120 | m_rect = path.boundingRect(); | |
116 | update(); |
|
121 | update(); | |
117 | } |
|
122 | } | |
|
123 | } | |||
118 |
|
124 | |||
119 | void AreaChartItem::handleUpdated() |
|
125 | void AreaChartItem::handleUpdated() | |
120 | { |
|
126 | { |
@@ -276,13 +276,26 void LineChartItem::updateGeometry() | |||||
276 | stroker.setCapStyle(Qt::SquareCap); |
|
276 | stroker.setCapStyle(Qt::SquareCap); | |
277 | stroker.setMiterLimit(m_linePen.miterLimit()); |
|
277 | stroker.setMiterLimit(m_linePen.miterLimit()); | |
278 |
|
278 | |||
|
279 | QPainterPath checkShapePath = stroker.createStroke(fullPath); | |||
|
280 | ||||
|
281 | // Only zoom in if the bounding rects of the paths fit inside int limits. QWidget::update() uses | |||
|
282 | // a region that has to be compatible with QRect. | |||
|
283 | if (checkShapePath.boundingRect().height() <= INT_MAX | |||
|
284 | && checkShapePath.boundingRect().width() <= INT_MAX | |||
|
285 | && linePath.boundingRect().height() <= INT_MAX | |||
|
286 | && linePath.boundingRect().width() <= INT_MAX | |||
|
287 | && fullPath.boundingRect().height() <= INT_MAX | |||
|
288 | && fullPath.boundingRect().width() <= INT_MAX) { | |||
279 | prepareGeometryChange(); |
|
289 | prepareGeometryChange(); | |
280 |
|
290 | |||
281 | m_linePath = linePath; |
|
291 | m_linePath = linePath; | |
282 | m_fullPath = fullPath; |
|
292 | m_fullPath = fullPath; | |
283 | m_shapePath = stroker.createStroke(fullPath); |
|
293 | m_shapePath = checkShapePath; | |
284 |
|
294 | |||
285 | m_rect = m_shapePath.boundingRect(); |
|
295 | m_rect = m_shapePath.boundingRect(); | |
|
296 | } else { | |||
|
297 | update(); | |||
|
298 | } | |||
286 | } |
|
299 | } | |
287 |
|
300 | |||
288 | void LineChartItem::handleUpdated() |
|
301 | void LineChartItem::handleUpdated() |
@@ -126,6 +126,10 void ScatterChartItem::updateGeometry() | |||||
126 |
|
126 | |||
127 | QRectF clipRect(QPointF(0,0),domain()->size()); |
|
127 | QRectF clipRect(QPointF(0,0),domain()->size()); | |
128 |
|
128 | |||
|
129 | // Only zoom in if the clipRect fits inside int limits. QWidget::update() uses | |||
|
130 | // a region that has to be compatible with QRect. | |||
|
131 | if (clipRect.height() <= INT_MAX | |||
|
132 | && clipRect.width() <= INT_MAX) { | |||
129 | QVector<bool> offGridStatus = offGridStatusVector(); |
|
133 | QVector<bool> offGridStatus = offGridStatusVector(); | |
130 | const int seriesLastIndex = m_series->count() - 1; |
|
134 | const int seriesLastIndex = m_series->count() - 1; | |
131 |
|
135 | |||
@@ -152,6 +156,7 void ScatterChartItem::updateGeometry() | |||||
152 | prepareGeometryChange(); |
|
156 | prepareGeometryChange(); | |
153 | m_rect = clipRect; |
|
157 | m_rect = clipRect; | |
154 | } |
|
158 | } | |
|
159 | } | |||
155 |
|
160 | |||
156 | void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
161 | void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | |
157 | { |
|
162 | { |
@@ -267,7 +267,6 void SplineChartItem::updateGeometry() | |||||
267 | } |
|
267 | } | |
268 | fullPath = splinePath; |
|
268 | fullPath = splinePath; | |
269 | } |
|
269 | } | |
270 | m_path = splinePath; |
|
|||
271 |
|
270 | |||
272 | QPainterPathStroker stroker; |
|
271 | QPainterPathStroker stroker; | |
273 | // The full path is comprised of three separate paths. |
|
272 | // The full path is comprised of three separate paths. | |
@@ -278,11 +277,21 void SplineChartItem::updateGeometry() | |||||
278 | stroker.setCapStyle(Qt::SquareCap); |
|
277 | stroker.setCapStyle(Qt::SquareCap); | |
279 | stroker.setMiterLimit(m_linePen.miterLimit()); |
|
278 | stroker.setMiterLimit(m_linePen.miterLimit()); | |
280 |
|
279 | |||
|
280 | // Only zoom in if the bounding rects of the path fit inside int limits. QWidget::update() uses | |||
|
281 | // a region that has to be compatible with QRect. | |||
|
282 | QPainterPath checkShapePath = stroker.createStroke(fullPath); | |||
|
283 | if (checkShapePath.boundingRect().height() <= INT_MAX | |||
|
284 | && checkShapePath.boundingRect().width() <= INT_MAX | |||
|
285 | && splinePath.boundingRect().height() <= INT_MAX | |||
|
286 | && splinePath.boundingRect().width() <= INT_MAX) { | |||
|
287 | m_path = splinePath; | |||
|
288 | ||||
281 | prepareGeometryChange(); |
|
289 | prepareGeometryChange(); | |
282 |
|
290 | |||
283 | m_fullPath = stroker.createStroke(fullPath); |
|
291 | m_fullPath = checkShapePath; | |
284 | m_rect = m_fullPath.boundingRect(); |
|
292 | m_rect = m_fullPath.boundingRect(); | |
285 | } |
|
293 | } | |
|
294 | } | |||
286 |
|
295 | |||
287 | /*! |
|
296 | /*! | |
288 | Calculates control points which are needed by QPainterPath.cubicTo function to draw the cubic Bezier cureve between two points. |
|
297 | Calculates control points which are needed by QPainterPath.cubicTo function to draw the cubic Bezier cureve between two points. |
General Comments 0
You need to be logged in to leave comments.
Login now