How about using QPainter::setWindow() and QPainter::setViewport()?