Important: Please read the Qt Code of Conduct -

QStyledItemDelegate item drawing over other items...

  • Hey

    I've subclassed a QStyledItemDelegate and paint function to do some drawing. I've re-styled my QCheckbox icon but I noticed that if the hierarchy tree goes very deep the checkbox eventually lies over other column and still draws. How can I check if given draw area is visible or being occluded by another column due to offsets?


  • Lifetime Qt Champion


    Can you show your painting code ?

  • @sgaist

    Hey, sorry for slow reply. You got me thinking about the issue! I initially was taking const QStyleOptionViewItem &option - option.rect - and creating my checkbox from it. But I never checked if that rect had any width/height in itself... I did a check now, and if the width of the rect is less than the width of my checkbox then I don't paint it! :D I should probably also check the position... but meh. So far works nice! :D

Log in to reply