Nominate our 2022 Qt Champions!

UPDATING comboBox of QTableWidget using SQLite3 Datbase???

  • Hi,
    I used following code to update sqlite3 database for ComboBox which is a widget in QTableWidget but its not getting updated.
    QString r (QString("UPDATE cockpit SET Status = '%1'").arg(;
    qDebug() <<;
    if( !qr.exec() )
    qDebug() << qr.lastError();
    qDebug( "Updated!" ); / here it executes and displays as Updated!

    But when close GUI and and run for the next time the updated value is still shows the precious value....
    i have used following lines to check the updated status column..
    qry.prepare("SELECT Status FROM cockpit");
    if( !qry.exec() )
    qDebug() << qry.lastError();
    else {
    // QComboBox *combos;

                   for( int r = 0; r < 9; r++ )   {
                          QComboBox *combos = qobject_cast<QComboBox*>(ui->tableWidget->cellWidget(r,1));
                              qDebug() << combos->currentText();

    Any help is appreciated....

  • Lifetime Qt Champion

    I cannot see where you put the values from SELECT query in your comboboxes

Log in to reply