Can you share how you have implemented the sizeHint function ?
May be you are not returning values based on index.

Also it will be easier if you use QItemDelegaterather than QAbstractItemDelegate