summaryrefslogtreecommitdiffstats
path: root/examples/widgets/graphicsview
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-03-03 12:14:43 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-04-25 17:58:40 +0000
commitc530ca1c170798159c3d84029841a1224d1cdc65 (patch)
tree99636a80d404634838ea440d9c066dd614e21839 /examples/widgets/graphicsview
parent220028d37c38835987b817193ecaf0e2a1ad066b (diff)
QLineF: add intersects() as a replacement for intersect()
QLineF::intersect() does not follow the naming rules for functions. Therefore add a replacement function intersects() instead and also rename the return type from IntersectType to IntersectionType [ChangeLog][QtCore][QLineF] added QLineF::intersects() as a replacement for QLineF::intersect() Change-Id: I744b960ea339cb817facb12f296f78cca3e7d938 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io> Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
Diffstat (limited to 'examples/widgets/graphicsview')
-rw-r--r--examples/widgets/graphicsview/diagramscene/arrow.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/examples/widgets/graphicsview/diagramscene/arrow.cpp b/examples/widgets/graphicsview/diagramscene/arrow.cpp
index 88160d9399..525e0b3fbb 100644
--- a/examples/widgets/graphicsview/diagramscene/arrow.cpp
+++ b/examples/widgets/graphicsview/diagramscene/arrow.cpp
@@ -113,15 +113,13 @@ void Arrow::paint(QPainter *painter, const QStyleOptionGraphicsItem *,
QLineF centerLine(myStartItem->pos(), myEndItem->pos());
QPolygonF endPolygon = myEndItem->polygon();
QPointF p1 = endPolygon.first() + myEndItem->pos();
- QPointF p2;
QPointF intersectPoint;
- QLineF polyLine;
for (int i = 1; i < endPolygon.count(); ++i) {
- p2 = endPolygon.at(i) + myEndItem->pos();
- polyLine = QLineF(p1, p2);
- QLineF::IntersectType intersectType =
- polyLine.intersect(centerLine, &intersectPoint);
- if (intersectType == QLineF::BoundedIntersection)
+ QPointF p2 = endPolygon.at(i) + myEndItem->pos();
+ QLineF polyLine = QLineF(p1, p2);
+ QLineF::IntersectionType intersectionType =
+ polyLine.intersects(centerLine, &intersectPoint);
+ if (intersectionType == QLineF::BoundedIntersection)
break;
p1 = p2;
}