TreeViewItem paint is off by a pixel


#1

I have a TreeView displaying some custom TreeViewItems

For these custom items I’ve overloaded the paintItem function
In there I’m just calling fillAll() on the Graphics object that gets passed in

Each tree item seems be be getting drawn slightly in the tree item above it

This is clearest on the last item

I’ve looked at the clip bounds of the Graphics object and its Y is -1, is this supposed to happen?
Am I missing something?

Should I just fillRect from 0?


#2

You might have a display or window that’s scaled by a non-integer factor? Just looks like a rounding error to me.


#3

Thanks for the quick reply
It seems to be caused by the Viewport
I’ve set the item’s size to be 45 and I’m printing out the Graphics clip bounds height

When I move Viewport’s scroll bar I’m getting values that differ by 1 around 46 and 47

I’ll keep investigating, thanks for pointing me in the right direction