There my deeper knowledge is gone, but I think that to handle erase etc for such an easy item (as shown in the attached image) is to much. Just draw the entire item in the paint-method depending on the state. At the beginning of paint() Qt deletes all previous content by default. That is - as I guess - better in performance than to erase (and then you surely want to move the blue rect...).

Lykurg