Add column to EditTableDialog to allow setting foreign key constraints

Add a new column to the fiel table in the Edit Table Dialog to allow the
user to add and edit foreign key constraints.
This commit is contained in:
Martin Kleusberg
2014-11-06 18:33:19 +01:00
parent 4b7766a0fe
commit 3277849121
3 changed files with 13 additions and 1 deletions

View File

@@ -112,6 +112,7 @@ void EditTableDialog::populateFields()
tbitem->setCheckState(kUnique, f->unique() ? Qt::Checked : Qt::Unchecked);
tbitem->setText(kDefault, f->defaultValue());
tbitem->setText(kCheck, f->check());
tbitem->setText(kForeignKey, f->foreignKey());
ui->treeWidget->addTopLevelItem(tbitem);
}
@@ -365,6 +366,11 @@ void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column)
if(!m_bNewTable)
callRenameColumn = true;
break;
case kForeignKey:
field->setForeignKey(item->text(column));
if(!m_bNewTable)
callRenameColumn = true;
break;
}
if(callRenameColumn)

View File

@@ -33,7 +33,8 @@ private:
kAutoIncrement = 4,
kUnique = 5,
kDefault = 6,
kCheck = 7
kCheck = 7,
kForeignKey = 8
};
void updateColumnWidth();

View File

@@ -269,6 +269,11 @@
<string>Check constraint</string>
</property>
</column>
<column>
<property name="text">
<string>Foreign Key</string>
</property>
</column>
</widget>
<widget class="QTextEdit" name="sqlTextEdit">
<property name="readOnly">