From cb77d33cc59e84679f38d854c967d28d158af94c Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 24 Mar 2020 16:50:40 +0100 Subject: [PATCH] QmlDesigner: Improve painting code for connection * Prefer horizontal connections * Fix horizontal corner cases Change-Id: I6867d104a1c97ef8dd8292bebe3e2a782a4ff000 Reviewed-by: Tim Jenssen --- .../components/formeditor/formeditoritem.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp index 31a5e6cab64..249abdc3d3d 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp @@ -754,7 +754,12 @@ static void paintConnection(QPainter *painter, const bool boolExitRight = from.right() < to.center().x(); const bool boolExitBottom = from.bottom() < to.center().y(); - bool horizontalFirst = horizontalOverlap(from, to) && !verticalOverlap(from, to); + bool horizontalFirst = true; + + /* + if (verticalOverlap(from, to) && !horizontalOverlap(from, to)) + horizontalFirst = false; + */ const qreal middleFactor = breakOffset / 100.0; @@ -764,14 +769,20 @@ static void paintConnection(QPainter *painter, if (horizontalFirst) { if (to.center().x() > from.left() && to.center().x() < from.right()) { - horizontalFirst = false; - extraLine = true; - } + horizontalFirst = false; + extraLine = true; + } else if (verticalOverlap(from, to)) { + horizontalFirst = true; + extraLine = true; + } } else { if (to.center().y() > from.top() && to.center().y() < from.bottom()) { horizontalFirst = true; extraLine = true; + } else if (horizontalOverlap(from, to)) { + horizontalFirst = false; + extraLine = true; } }