Compare the size of the painter to the size of the device or use QPainter::setWindow() and QPainter::setViewport()