Important: Please read the Qt Code of Conduct -

QSqlRelationalTableModel::removeRow causes relation delegate to dissapear before select()

  • If I use QSqlRelationalTableModel::removeRow to remove a row from my QTableView, it keeps the row visible and marks it with "!" sign and this is what I want it to do. One of the columns is a relation column:

    int role_idx = model->fieldIndex("role_id");
    model->setRelation(role_idx, QSqlRelation("Roles", "id", "role_name"));

    After I use removeRow(), the delegate (which is QComboBox created automatically, I didn't set my own QItemDelegate for the column) dissapears. It has no inpact on anything but is weird nonetheless, and looks bad. I would prefer all the delegates to dissapear, or none of them. Why is it not so, and how to change it?