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. Remove row form QSqlTableModel problem?
Forum Updated to NodeBB v4.3 + New Features

Remove row form QSqlTableModel problem?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 4.4k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    MuhamedAuda
    wrote on last edited by
    #1

    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();
    

    }
    @

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MuhamedAuda
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MuhamedAuda
          wrote on last edited by
          #4

          thx too

          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