summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukáš Lalinský <lalinsky@gmail.com>2008-12-07 14:08:22 +0100
committerLukáš Lalinský <lalinsky@gmail.com>2008-12-07 14:08:22 +0100
commit8899b36403190fa6dc7e37be60944e0ff43e1b2b (patch)
treea9dd307987474bd1121df391ee19457e5db69160
parent2124865820d4b1dfe68580c81972b86d02823d74 (diff)
downloaddbmodel-8899b36403190fa6dc7e37be60944e0ff43e1b2b.tar.gz
dbmodel-8899b36403190fa6dc7e37be60944e0ff43e1b2b.tar.bz2
Use only simple lines for now, hardcode z-values
-rw-r--r--src/databaserelationship.cpp20
-rw-r--r--src/diagramconnection.cpp1
-rw-r--r--src/diagramdocument.cpp4
-rw-r--r--src/diagramobject.cpp1
4 files changed, 5 insertions, 21 deletions
diff --git a/src/databaserelationship.cpp b/src/databaserelationship.cpp
index f6555c0..2858f60 100644
--- a/src/databaserelationship.cpp
+++ b/src/databaserelationship.cpp
@@ -31,7 +31,6 @@ QRectF
DatabaseRelationship::boundingRect() const
{
return shape().boundingRect();
- //return QRectF(m_line.p1(), m_line.p2()).normalized();
}
QPainterPath
@@ -111,7 +110,7 @@ DatabaseRelationship::updateLayout()
Range<qreal> horizontalIntersection = horizontalRange1.intersected(horizontalRange2);
// Straight horizontal line
- if (!haveLine) {
+ if (0 && !haveLine) {
if (!verticalIntersection.isNull() && horizontalIntersection.isNull()) {
qreal y = verticalIntersection.min() + verticalIntersection.length() / 2;
if (rect1.right() < rect2.left()) {
@@ -125,7 +124,7 @@ DatabaseRelationship::updateLayout()
}
// Straight vertical line
- if (!haveLine) {
+ if (0 && !haveLine) {
if (verticalIntersection.isNull() && !horizontalIntersection.isNull()) {
qreal x = horizontalIntersection.min() + horizontalIntersection.length() / 2;
if (rect1.bottom() < rect2.top()) {
@@ -139,7 +138,7 @@ DatabaseRelationship::updateLayout()
}
// Two-segment line
- if (!haveLine) {
+ if (0 && !haveLine) {
qreal x1, x2, x3, y1, y2, y3;
@@ -181,19 +180,6 @@ DatabaseRelationship::updateLayout()
<< QPointF(x2, y2)
<< QPointF(x3, y3);
haveLine = true;
-
-
-/*
- if (verticalIntersection.isNull() && !horizontalIntersection.isNull()) {
- qreal x = horizontalIntersection.min() + horizontalIntersection.length() / 2;
- if (rect1.bottom() < rect2.top()) {
- m_line = QLineF(x, rect1.bottom(), x, rect2.top());
- }
- else {
- m_line = QLineF(x, rect1.top(), x, rect2.bottom());
- }
- haveLine = true;
- }*/
}
// Simple center<->center line
diff --git a/src/diagramconnection.cpp b/src/diagramconnection.cpp
index 5aae2bb..1b1865a 100644
--- a/src/diagramconnection.cpp
+++ b/src/diagramconnection.cpp
@@ -19,6 +19,7 @@
DiagramConnection::DiagramConnection(DiagramItem *parent)
: DiagramItem(parent)
{
+ setZValue(1.0);
m_objects[0] = 0;
m_objects[1] = 0;
}
diff --git a/src/diagramdocument.cpp b/src/diagramdocument.cpp
index 2aa486d..351124f 100644
--- a/src/diagramdocument.cpp
+++ b/src/diagramdocument.cpp
@@ -92,7 +92,6 @@ DiagramDocument::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (m_mode == AddTable && event->button() == Qt::LeftButton) {
DatabaseTable *table = new DatabaseTable();
table->setPos(event->scenePos());
- table->setZValue(10.0);
undoStack()->push(new AddItemCommand(this, table));
clearSelection();
table->setSelected(true);
@@ -130,14 +129,11 @@ DiagramDocument::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
DatabaseTable *source = qgraphicsitem_cast<DatabaseTable *>(itemAt(m_line->line().p1()));
DatabaseTable *target = qgraphicsitem_cast<DatabaseTable *>(itemAt(m_line->line().p2()));
if (source && target && source != target) {
- //qDebug() << "Add relation between " << source << " and " << target;
DatabaseRelationship *relation = new DatabaseRelationship();
relation->setSource(source);
relation->setTarget(target);
- relation->setZValue(1.0);
undoStack()->push(new AddItemCommand(this, relation));
}
-
delete m_line;
m_line = NULL;
setMode(Select);
diff --git a/src/diagramobject.cpp b/src/diagramobject.cpp
index 8b0d5b3..e0d6c17 100644
--- a/src/diagramobject.cpp
+++ b/src/diagramobject.cpp
@@ -19,4 +19,5 @@
DiagramObject::DiagramObject(DiagramItem *parent)
: DiagramItem(parent)
{
+ setZValue(100.0);
}