Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Implement connection lines in KoSvgTextShapeOutlineHelper
Wolthera van Hövell tot Westerflierf82a34a01e77
diff --git a/libs/flake/text/KoSvgTextShapeOutlineHelper.cpp b/libs/flake/text/KoSvgTextShapeOutlineHelper.cppindex fc1267df47..b45d14e4ef 100644--- a/libs/flake/text/KoSvgTextShapeOutlineHelper.cpp+++ b/libs/flake/text/KoSvgTextShapeOutlineHelper.cpp@@ -92,7 +92,43 @@ void KoSvgTextShapeOutlineHelper::paintTextShape(QPainter *painter, const KoView}}if (d->drawTextWrappingArea) {- Q_FOREACH(const QPainterPath path, text->textWrappingAreas()) {+ QList<QPainterPath> areas = text->textWrappingAreas();+ if (areas.size() > 1) {+ for (int i = 1; i < areas.size(); i++) {+ const QPainterPath previous = areas.at(i-1);+ const QPainterPath next = areas.at(i);+ const bool overlap = previous.intersects(next);+ QLineF arrow(previous.boundingRect().center(), next.boundingRect().center());+ if (!overlap) {++ Q_FOREACH (QPolygonF p, previous.toSubpathPolygons()) {+ if (p.size() == 1) continue;+ for (int j = 1; j < p.size(); j++) {+ QLineF l2(p.at(j-1), p.at(j));+ QPointF intersect;+ if (l2.intersects(arrow, &intersect) == QLineF::BoundedIntersection) {+ arrow.setP1(intersect);+ break;+ }+ }+ }+ Q_FOREACH (QPolygonF p, next.toSubpathPolygons()) {+ if (p.size() == 1) continue;+ for (int j = 1; j < p.size(); j++) {+ QLineF l2(p.at(j-1), p.at(j));+ QPointF intersect;+ if (l2.intersects(arrow, &intersect) == QLineF::BoundedIntersection) {+ arrow.setP2(intersect);+ break;+ }+ }+ }++ }+ helper.drawGradientArrow(arrow.p1(), arrow.p2(), 1.5 * d->handleRadius);+ }+ }+ Q_FOREACH(const QPainterPath path, areas) {helper.drawPath(path);}}diff --git a/libs/flake/text/KoSvgTextShapeOutlineHelper.h b/libs/flake/text/KoSvgTextShapeOutlineHelper.hindex 76f0bba71b..5b72ecff51 100644--- a/libs/flake/text/KoSvgTextShapeOutlineHelper.h+++ b/libs/flake/text/KoSvgTextShapeOutlineHelper.h@@ -45,8 +45,9 @@ public:/*** @brief setDrawTextWrappingArea- * draw the wrapping area. The wrapping area is computer from+ * draw the wrapping area. The wrapping area is computed from* the shapes as well as padding and margin.+ * This also draws connection lines.*/void setDrawTextWrappingArea(bool enable);bool drawTextWrappingArea() const;