Two QGraphicsItem-s change position around each other upon scaling

I have a problem with QGraphicsItem.
Sometimes when I setScale to two graphics items in the same scene (one of them is pixmap item and one of them is custom fillrect item), they seem to change relative positions. It does not happen on all scale factors, just from time to time. For example:Shifted exampleNormal example
On the first one, rectangle is slightly shifted, but if I scale up (or down) more, it will come back to normal (second image). If i scale even more it might become shifted but on the lowest scale factors it will always be in a normal position. I think it happens on the same scale factors all the time, so its not random.