mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Do not allow empty tables in EditTableForm
Do not allow the creation of a table without any columns as this would lead to an SQL error.
This commit is contained in:
@@ -129,6 +129,8 @@ void editTableForm::checkInput()
|
||||
bool valid = true;
|
||||
if(ui->editTableName->text().isEmpty() || ui->editTableName->text().contains(" "))
|
||||
valid = false;
|
||||
if(ui->treeWidget->topLevelItemCount() == 0)
|
||||
valid = false;
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid);
|
||||
}
|
||||
|
||||
@@ -167,6 +169,7 @@ void editTableForm::addField()
|
||||
tbitem->setText(1, dialog.field_type);
|
||||
modified = true;
|
||||
ui->treeWidget->addTopLevelItem(tbitem);
|
||||
checkInput();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,6 +197,8 @@ void editTableForm::removeField()
|
||||
QMessageBox::information(this, QApplication::applicationName(), tr("Sorry! This function is currently not implemented as SQLite does not support the deletion of columns yet."));
|
||||
// }
|
||||
}
|
||||
|
||||
checkInput();
|
||||
}
|
||||
|
||||
void editTableForm::fieldSelectionChanged()
|
||||
|
||||
@@ -270,6 +270,22 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>treeWidget</sender>
|
||||
<signal>itemChanged(QTreeWidgetItem*,int)</signal>
|
||||
<receiver>editTableForm</receiver>
|
||||
<slot>checkInput()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>138</x>
|
||||
<y>197</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>412</x>
|
||||
<y>135</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>fieldSelectionChanged()</slot>
|
||||
|
||||
Reference in New Issue
Block a user