diff options
author | Lukáš Lalinský <lalinsky@gmail.com> | 2008-12-31 11:08:29 +0100 |
---|---|---|
committer | Lukáš Lalinský <lalinsky@gmail.com> | 2008-12-31 11:08:29 +0100 |
commit | e40be8a9658095b5d7e87afdf4a95762885e7aab (patch) | |
tree | 0586c6a25e4f26c0f958ef25614fcc215ed74eef /src/items/database | |
parent | ca579d4487f431baf791ccb0c2635fb339cdfacf (diff) | |
download | dbmodel-e40be8a9658095b5d7e87afdf4a95762885e7aab.tar.xz |
Update line layouts in a singleshot timer
Diffstat (limited to 'src/items/database')
-rw-r--r-- | src/items/database/databaserelationship.cpp | 55 | ||||
-rw-r--r-- | src/items/database/databaserelationship.h | 2 |
2 files changed, 2 insertions, 55 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(); diff --git a/src/items/database/databaserelationship.h b/src/items/database/databaserelationship.h index 5d90053..b11f93e 100644 --- a/src/items/database/databaserelationship.h +++ b/src/items/database/databaserelationship.h @@ -54,8 +54,6 @@ public: void loadFromXml(QDomElement element, DiagramDocument *document = 0); void saveToXml(QDomDocument doc, QDomElement element); - void updatePositions(); - //! Returns true if the foreign key on the child table is also the primary key bool isIdentifying() const; |