diff options
Diffstat (limited to 'src/items/database/databaserelationship.cpp')
-rw-r--r-- | src/items/database/databaserelationship.cpp | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/src/items/database/databaserelationship.cpp b/src/items/database/databaserelationship.cpp index e120786..c47375a 100644 --- a/src/items/database/databaserelationship.cpp +++ b/src/items/database/databaserelationship.cpp @@ -278,69 +278,18 @@ DatabaseRelationship::itemChange(GraphicsItemChange change, const QVariant &valu } void -DatabaseRelationship::updatePositions() -{ - updateLayout(); - update(); -} - -void DatabaseRelationship::updateLayout() { if (!scene()) return; - Connector *connector1 = connector(0); - Connector *connector2 = connector(1); - - DatabaseTable *source = childTable(); - DatabaseTable *target = parentTable(); - if (!source || !target) - return; - prepareGeometryChange(); - QRectF rect1 = source->boundingRect().translated(source->pos()); - QRectF rect2 = target->boundingRect().translated(target->pos()); + Connector *connector1 = connector(0); + Connector *connector2 = connector(1); bool haveLine = false; - Range<qreal> verticalRange1(rect1.top(), rect1.bottom()); - Range<qreal> verticalRange2(rect2.top(), rect2.bottom()); - Range<qreal> verticalIntersection = verticalRange1.intersected(verticalRange2); - - Range<qreal> horizontalRange1(rect1.left(), rect1.right()); - Range<qreal> horizontalRange2(rect2.left(), rect2.right()); - Range<qreal> horizontalIntersection = horizontalRange1.intersected(horizontalRange2); - - // Straight horizontal line - if (0 && !haveLine) { - if (!verticalIntersection.isNull() && horizontalIntersection.isNull()) { - qreal y = verticalIntersection.min() + verticalIntersection.length() / 2; - if (rect1.right() < rect2.left()) { - d->line = QPolygonF() << QPointF(rect1.right(), y) << QPointF(rect2.left(), y); - } - else { - d->line = QPolygonF() << QPointF(rect1.left(), y) << QPointF(rect2.right(), y); - } - haveLine = true; - } - } - - // Straight vertical line - if (0 && !haveLine) { - if (verticalIntersection.isNull() && !horizontalIntersection.isNull()) { - qreal x = horizontalIntersection.min() + horizontalIntersection.length() / 2; - if (rect1.bottom() < rect2.top()) { - d->line = QPolygonF() << QPointF(x, rect1.bottom()) << QPointF(x, rect2.top()); - } - else { - d->line = QPolygonF() << QPointF(x, rect1.top()) << QPointF(x, rect2.bottom()); - } - haveLine = true; - } - } - // Orthogonal line if (!haveLine) { QPointF p1 = connector1->pos(); |