I created a QTableView with a QSqlTableModel. By standard, double-clicking on the cells will mark them and the user can edit them. I want, that the user isn't allowed to do that. He is allowed to mark the whole row by clicking on a single cell, but not to edit the cell. How can I do that?
Depending on whether you are coding everything or doing things in the designer, set
editTriggers
to QAbstractItemView::NoEditTriggers
selectionBehavior
to QAbstractItemView::SelectRows
selectionMode
to QAbstractItemView::SingleSelection
if you want the user to select exactly one rowon the tableview object the appropriate calls will all be prefixed with set
e.g setEditTriggers()
in the Designer you can find these option in the AbstractItemView
section