I have a QTreeWidget with the following shape:
Root
- Item1
-- Sub11
--- Sub111
-- Sub12
--- Sub121
...
When double clicking on any item from the QTreeWidget the selection expands by default (or collapsed if it was already expanded). I created a simple function tree_get_details(self, item, column) to print item and column of the double clicked item and connected it with itemDoubleClicked. This works nicely so far. However how can I make this function available only at bottom layer of the tree (ie for subXXX rows). Hence for Root, Item1, Item2, Sub11, Sub12 just the default behaviour for the double clicked event and for Sub111, Sub121 printing item and column?
Somehow I need to test in my function tree_get_details if the "item" passed in argument is at the bottom layer. I know of the topLevelItem method but can't find the corresponding bottom one (if it exists...). My tree has 4-level hierarchy.