How can I update a TableView after closing a Dialog?
Example:
main.ccp abre conexão com banco de dados
principal::principal(){
//..etc..//
model->setTable("nomeTabela");
model->setEditStrategy(QSqlTableModel::OnManualSubmit);
model->setHeaderData(0, Qt::Horizontal, tr("Lista da tabela"));
model->select();
}
Dialog.cpp Apenas query de insert na tabela nomeTabela
void Dialog::on_cadastroDados_clicked()
{
QSqlQuery qry;
qry.prepare("INSERT INTO nomeTabela/..
qry.addBindValue/...
qry.exec/..
//true
QDialog::Closet();
}