@@ -110,11 +110,17 void AreaChartItem::updatePath() | |||
|
110 | 110 | } |
|
111 | 111 | } |
|
112 | 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 | 118 | prepareGeometryChange(); |
|
114 | 119 | m_path = path; |
|
115 | 120 | m_rect = path.boundingRect(); |
|
116 | 121 | update(); |
|
117 | 122 | } |
|
123 | } | |
|
118 | 124 | |
|
119 | 125 | void AreaChartItem::handleUpdated() |
|
120 | 126 | { |
@@ -276,13 +276,26 void LineChartItem::updateGeometry() | |||
|
276 | 276 | stroker.setCapStyle(Qt::SquareCap); |
|
277 | 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 | 289 | prepareGeometryChange(); |
|
280 | 290 | |
|
281 | 291 | m_linePath = linePath; |
|
282 | 292 | m_fullPath = fullPath; |
|
283 | m_shapePath = stroker.createStroke(fullPath); | |
|
293 | m_shapePath = checkShapePath; | |
|
284 | 294 | |
|
285 | 295 | m_rect = m_shapePath.boundingRect(); |
|
296 | } else { | |
|
297 | update(); | |
|
298 | } | |
|
286 | 299 | } |
|
287 | 300 | |
|
288 | 301 | void LineChartItem::handleUpdated() |
@@ -126,6 +126,10 void ScatterChartItem::updateGeometry() | |||
|
126 | 126 | |
|
127 | 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 | 133 | QVector<bool> offGridStatus = offGridStatusVector(); |
|
130 | 134 | const int seriesLastIndex = m_series->count() - 1; |
|
131 | 135 | |
@@ -152,6 +156,7 void ScatterChartItem::updateGeometry() | |||
|
152 | 156 | prepareGeometryChange(); |
|
153 | 157 | m_rect = clipRect; |
|
154 | 158 | } |
|
159 | } | |
|
155 | 160 | |
|
156 | 161 | void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
157 | 162 | { |
@@ -267,7 +267,6 void SplineChartItem::updateGeometry() | |||
|
267 | 267 | } |
|
268 | 268 | fullPath = splinePath; |
|
269 | 269 | } |
|
270 | m_path = splinePath; | |
|
271 | 270 | |
|
272 | 271 | QPainterPathStroker stroker; |
|
273 | 272 | // The full path is comprised of three separate paths. |
@@ -278,11 +277,21 void SplineChartItem::updateGeometry() | |||
|
278 | 277 | stroker.setCapStyle(Qt::SquareCap); |
|
279 | 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 | 289 | prepareGeometryChange(); |
|
282 | 290 | |
|
283 | m_fullPath = stroker.createStroke(fullPath); | |
|
291 | m_fullPath = checkShapePath; | |
|
284 | 292 | m_rect = m_fullPath.boundingRect(); |
|
285 | 293 | } |
|
294 | } | |
|
286 | 295 | |
|
287 | 296 | /*! |
|
288 | 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