
Originally Posted by
jml
The problem with that is that it still allows you to TAB to the next cell. It just doesn't store the data in the model. It doesn't provide any cursor control.
I finally solved the problem. QItemDelegate re-implements the virtual function eventFilter. So I just created a new class derived from QItemDelegate.
In eventFilter, if it's not a TAB key:
return QItemDelegate::eventFilter(editor, event);
To copy to clipboard, switch view to plain text mode
If it is a TAB and validates OK:
emit commitData(lineEdit);
return true;
emit commitData(lineEdit);
emit closeEditor(lineEdit, QAbstractItemDelegate::EditNextItem);
return true;
To copy to clipboard, switch view to plain text mode
If not:
return true
emit closeEditor(lineEdit, QAbstractItemDelegate::NoHint);
return true
To copy to clipboard, switch view to plain text mode
Bookmarks