If the event propagates from the view to the parent widget, it's coordinates are mapped to the coordinates of the parent widget whereas if you call any of the view's methods (like indexAt) it expects the coordinates to be in either the view's or the view's viewport (depending on the method) coordinate space. So you first have to map those coordinates using the family of mapTo*/mapFrom* methods.
And with all do respect to your C++ skills think if exposing the internal representation of the tree and handling internal affairs of the tree in some external place (like the MainWindow class) is a good design decision of a skilled C++ developer.
Bookmarks