Moved code calculating position in parent widget to function getIndexInParent().