QmlDesigner: Improve painting code for connection

* Prefer horizontal connections
* Fix horizontal corner cases

Change-Id: I6867d104a1c97ef8dd8292bebe3e2a782a4ff000
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2020-03-24 16:50:40 +01:00
committed by Tim Jenssen
parent 208fbe18c1
commit cb77d33cc5

View File

@@ -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;
}
}