I want to check the text of a row in QListView
before the user is editing it. If it doesn't fit a pattern, I don't want to accept it.
Currently I have a QListView
and QStandardItemModel
. I can easily add and remove items via the QStandardItemModel
. I also set the model of the list view.
Are there some delegates
or event
function(s) on the list or the model for editing?
you can overload
data()
andsetData()
functions fromQStandardItemModel
, then when user tries to edit item yoursetData
will be called withQt::EditRole
and there you can do your processing.http://qt-project.org/doc/qt-5.0/qtcore/qabstractitemmodel.html#setData