def selectrect_copy(self):
        """
        Copy a rectangle region of the current image, returning it.

        :return: QPixmap of the copied region.
        """
        self.timer_cleanup()
        return self.pixmap().copy(QRect(self.origin_pos, self.current_pos))

        Copy a rectangle region of the current image, returning it.

        :return: QPixmap of the copied region.
        
pyside6/demos/paint/canvas.py