Uneditable QListView
Adding the line:
self.listView.setEditTriggers(QAbstractItemView.NoEditTriggers)
should fix things for you.
QListView
inherits QAbstractItemView
which has the method setEditTriggers()
. Other possible values for setEditTriggers
are available in the docs.
Thanks for the responses. I ended up going with a QListWidget
instead as it is not editable by default.
Though I also found if you give the QListView
a mouse Double clicked event and set it to do something other than edit the QListView
, it overrides the edit function so that works too.