Fix drawing bug with QPainter