EditTableDialog: Also update the SQL when type is automatically changed

Also update the internal table representation and thus the SQL string at
the bottom of the window when the type of a column is changed
automatically, e.g. when the AI checkbox is clicked.

Closes #24.
This commit is contained in:
Martin Kleusberg
2014-05-27 20:13:18 +02:00
parent 2fcb131c25
commit a209e840b8

View File

@@ -313,10 +313,10 @@ void EditTableDialog::addField()
tbitem->setText(kName, "Field" + QString::number(ui->treeWidget->topLevelItemCount()));
QComboBox* typeBox = new QComboBox(ui->treeWidget);
typeBox->setProperty("column", tbitem->text(kName));
connect(typeBox, SIGNAL(activated(int)), this, SLOT(updateTypes()));
typeBox->setEditable(false);
typeBox->addItems(sqlb::Field::Datatypes);
ui->treeWidget->setItemWidget(tbitem, kType, typeBox);
connect(typeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTypes()));
tbitem->setCheckState(kNotNull, Qt::Unchecked);
tbitem->setCheckState(kPrimaryKey, Qt::Unchecked);