Hello,

How to remove a record from a table with a composed primary key using QModelIndex and removeRow?

In tables with simple primary key (just one column) it works fine with:

Qt Code:
  1. QModelIndex index = sequenceTableView->currentIndex();
  2. if (!index.isValid())
  3. return;
  4. sequenceModel->removeRow(index.row());
  5. }
To copy to clipboard, switch view to plain text mode 

but with 2 columns (with similar code) i can't delete the record and in the output window appears the message:

QSqlQuery::value: not positioned on a valid record


Any help would be appreciated.
Thanks,
Palma