Details
-
Bug
-
Resolution: Invalid
-
P3: Somewhat important
-
None
-
5.6.3, 5.12.0 RC
Description
It seems that QTreeWidget's itemAt does not take header into account, hence itemAt(p) p is not relative to widget's viewport. In order for itemAt to return a correct item based on given coordinates, one has to reduce header height from p's Y value, like:
QPoint fixedPos(helpEvent->pos()); fixedPos.setY(fixedPos.y() - this->header()->height()); QTreeWidgetItem* item = this->itemAt(fixedPos);
Please find the attached example which demonstrates this issue. In the example, move mouse cursor on top of one of the items and see what the example prints in the output.
This seems to be an old issue (reproduced with 5.12, 5.11 and 5.6.3), so changing the behavior might not be well received, but this should at least be mentioned in the documents and possibly show a workaround solution how to make it work