PDA

View Full Version : QTreeView, ItemDelegates and Tab Key Navigation



smhall316
19th August 2013, 14:13
I have built a QTreeView with my own custom model. I have also created an item delegate to use as my input mechanism in my widget. I am coming across some strange behavior when entering text and attempting to move onto the next item. I have reimplemented keyPressEvent in my delegate to look for the Enter Key, Return Key, the up and down arrows and the tab key. I want to capture the data and then tell the tree view to move to the next item. This works fine for the enter, return and the up and down arrows. For some reason, my over-ridden keyPressEvent is never entered for the tab key. When the tab key is pressed I get an edit: editing failed message. I have tried to disable tab navigation in the QTreeView by over-riding its keyPressEvent and disabling tab navigation with setTabKeyNavigation to false but nothing is working. I don't know why my item delegate's keyPressEvent is not being called when the tab key is hit when all the other keys invoke it.

high_flyer
22nd August 2013, 10:21
Can you show the relevant code?