QTreeWidget.itemAt returns wrong item in dropEvent
Solved
General and Desktop
-
Hello,
Code in QTreeWidget dropEvent:
targetItem = self.targetTree.itemAt(event.position().x(), event.position().y())
the item returned is consistently 4 rows under the correct one. Why is that?
TIA
-
@ForeverNoob said in QTreeWidget.itemAt returns wrong item in dropEvent:
Why is that?
It can only be for one reason:
event.position().x(), event.position().y()
these coords are not what you would expect.
The documentation says:
item at the coordinates (x, y). The coordinates are relative to the tree widget's viewport().
So compare that with the position of your correct item
-