Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. UPDATING comboBox of QTableWidget using SQLite3 Datbase???
QtWS25 Last Chance

UPDATING comboBox of QTableWidget using SQLite3 Datbase???

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 674 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vIJI
    wrote on last edited by
    #1

    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....

    1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved