def cropImage(qpixmap, qrect):
    """Returns a cropped QPixmap using the QRect as dimensions."""
    if qrect.width == 0 or qrect.height == 0:
        return None
    return qpixmap.copy(qrect.normalized())