forked from qt-creator/qt-creator
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:
committed by
Tim Jenssen
parent
208fbe18c1
commit
cb77d33cc5
@@ -754,7 +754,12 @@ static void paintConnection(QPainter *painter,
|
|||||||
const bool boolExitRight = from.right() < to.center().x();
|
const bool boolExitRight = from.right() < to.center().x();
|
||||||
const bool boolExitBottom = from.bottom() < to.center().y();
|
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;
|
const qreal middleFactor = breakOffset / 100.0;
|
||||||
|
|
||||||
@@ -766,12 +771,18 @@ static void paintConnection(QPainter *painter,
|
|||||||
if (to.center().x() > from.left() && to.center().x() < from.right()) {
|
if (to.center().x() > from.left() && to.center().x() < from.right()) {
|
||||||
horizontalFirst = false;
|
horizontalFirst = false;
|
||||||
extraLine = true;
|
extraLine = true;
|
||||||
|
} else if (verticalOverlap(from, to)) {
|
||||||
|
horizontalFirst = true;
|
||||||
|
extraLine = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (to.center().y() > from.top() && to.center().y() < from.bottom()) {
|
if (to.center().y() > from.top() && to.center().y() < from.bottom()) {
|
||||||
horizontalFirst = true;
|
horizontalFirst = true;
|
||||||
extraLine = true;
|
extraLine = true;
|
||||||
|
} else if (horizontalOverlap(from, to)) {
|
||||||
|
horizontalFirst = false;
|
||||||
|
extraLine = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user