By default, the editor commits the data on Enter press, Tab press or focus change. I need to discard edits on focus change or Tab press instead of committing them to the model. How do I do that? I already have my own delegate class, can I do it with its help?
You should take a look at what is going on for base class :
$QT482DIR/src/gui/itemviews/qitemdelegate.cpp
bool QItemDelegate::eventFilter(QObject *object, QEvent *event)
And overload this method to change the default behaviour. Just taking a look at it, I would follow commitData()
and closeEditor()
calls. As well as _q_commitDataAndCloseEditor
to see what's going on