So I desired to remove the ugly dotted border on my QTreeWidget by setting NoFocus on the focus policy. Now I need to catch keyPressEvents, but the focus policy is preventing that. Any ideas how one might circumvent this catch 22 so that I can catch a delete key press for easy item deletion? Thanks in advance!
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I assume you are trying to do something that you really shouldn't, but anyways …
This is the way to go: http://doc.qt.io/qt-4.8/qwidget.html#grabKeyboard