1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| this->model = new QSqlQueryModel();
model->setQuery("SELECT Nom FROM Projet.dbo.Produit");
ui->comboBox->setModel(model);
this->model2 = new QSqlQueryModel();
model2->setQuery("SELECT DISTINCT N_Four FROM Projet.dbo.Produit");
ui->comboBox_2->setModel(model2);
QSqlQuery query5;
query5.prepare("SELECT N_Four FROM Projet.dbo.Produit WHERE Nom=:nom");
query5.bindValue(":nom", ui->comboBox->currentText());
if (query5.exec() && query5.next()) {
ui->comboBox_2->setItemText(0,query5.value(0).toString());
}
void fiche_article::on_comboBox_currentIndexChanged(const QString &arg1)
{
QSqlQuery query5;
query5.prepare("SELECT N_Four FROM Projet.dbo.Produit WHERE Nom=:nom");
query5.bindValue(":nom", ui->comboBox->currentText());
if (query5.exec() && query5.next()) {
ui->comboBox_2->setItemText(0,query5.value(0).toString());
} |