Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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(lis.at(0)));
    qDebug() << lis.at(0);
    qr.prepare(r);
    if( !qr.exec() )
    qDebug() << qr.lastError();
    else
    qDebug( "Updated!" ); / here it executes and displays as Updated!

    But when close GUI and and run for the next time the updated value is lost....it 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