summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukáš Lalinský <lalinsky@gmail.com>2008-12-11 16:13:29 +0100
committerLukáš Lalinský <lalinsky@gmail.com>2008-12-11 16:13:29 +0100
commit0d706c18d9568286b18e1cef64286e84f2c3e557 (patch)
tree6001f0ead86a1973c5c13119aa628fde4fc66231
parentcc062cd6002ba1805e2cb3fb86afeca3a7a5d6fa (diff)
downloaddbmodel-0d706c18d9568286b18e1cef64286e84f2c3e557.tar.gz
dbmodel-0d706c18d9568286b18e1cef64286e84f2c3e557.tar.bz2
Temporary commit
-rw-r--r--src/items/database/databaserelationship.h12
-rw-r--r--src/items/database/databaserelationshipproperties.cpp14
2 files changed, 22 insertions, 4 deletions
diff --git a/src/items/database/databaserelationship.h b/src/items/database/databaserelationship.h
index 0447d3b..b345f33 100644
--- a/src/items/database/databaserelationship.h
+++ b/src/items/database/databaserelationship.h
@@ -47,6 +47,18 @@ public:
void updatePositions();
+ //! Returns true if the foreign key on the child table is also the primary key
+ bool isIdentifying();
+
+ //! Returns true if the foreign key on the child table is required (NOT NULL)
+ bool isRequired();
+
+ //! Returns the cardinality of the relationship
+ Pair<int, int> cardinality();
+
+ //! Sets the relationship cardinality
+ void setCardinality(Pair<int, int> cardinality);
+
static DiagramItemProperties *createPropertiesEditor(QWidget *parent = 0);
protected slots:
diff --git a/src/items/database/databaserelationshipproperties.cpp b/src/items/database/databaserelationshipproperties.cpp
index cb3866d..aca6fe9 100644
--- a/src/items/database/databaserelationshipproperties.cpp
+++ b/src/items/database/databaserelationshipproperties.cpp
@@ -42,14 +42,20 @@ DatabaseRelationshipProperties::createRelationshipPage()
QWidget *page = new QWidget(this);
QGridLayout *layout = new QGridLayout(page);
+ int row = 0;
d->nameEdit = new QLineEdit(page);
- layout->addWidget(new QLabel(tr("Name:"), page), 0, 0);
- layout->addWidget(d->nameEdit, 0, 1);
+ layout->addWidget(new QLabel(tr("Name:"), page), row, 0);
+ layout->addWidget(d->nameEdit, row, 1);
d->generateNameCheckBox = new QCheckBox(tr("Generated"), page);
connect(d->generateNameCheckBox, SIGNAL(toggled(bool)), d->nameEdit, SLOT(setDisabled(bool)));
d->generateNameCheckBox->setChecked(true);
- layout->addWidget(d->generateNameCheckBox, 0, 2);
- layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 1, 0, 1, 3);
+ layout->addWidget(d->generateNameCheckBox, row, 2);
+
+ row++;
+ layout->addWidget(new QLabel(tr("Cardinality:"), page), row, 0);
+
+ row++;
+ layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), row, 0, row, 3);
return page;
}