Handling keyboard input in QListView
I would like to delete an item from a QListView when the delete key is pressed. I know I can override QListView::keyPressEvent but I need to do the deletion from a different class. Is there any signal I could use to detect开发者_运维知识库 the delete key?
Check QObject::installEventFilter, I think it is exactly what you are looking for and also has a small example for your case.
精彩评论