Remove row form QSqlTableModel problem?



  • we have QSqlTableModel linked to QSQLITE table.
    when i perform removeRow() method the ! appear.
    i d'like to disappear row immediately. my Algorithm like this:

    • remove current row.
    • disappear immediately.
    • changes saved to database.

    i have try various strategy to solve problem. and then post it here to find standard guidelines:

    *model strategy: *
    @ pctypesTableModel->setEditStrategy(QSqlTableModel::OnRowChange);@

    // command signal and slot:
    @connect(ui->DeleteButton, SIGNAL(clicked()), this, SLOT(removePcType()));@

    @void editPcTypeDialog::removePcType() // private slot
    {
    int row = ui->tableView->currentIndex().row();
    //ui->tableView->hideRow(row);

    pctypesTableModel->removeRows(row, 1, ui->tableView->currentIndex());
    //pctypesTableModel->submit();
    //pctypesTableModel->submitAll();
    

    }
    @



  • QSqlTableModel does no longer implicitly select() once a row has been removed; you will have to call select() explicitly.



  • bq. QSqlTableModel does no longer implicitly select() once a row has been removed; you will have to call select() explicitly.

    thank u too i will work on this idea and *post results laters *An Chaa Allah.



  • thx too


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.