ui/ImageView.py
def calc_crop_rect(self, drag_rect: QRectF):
        """
        Crop a rectangle to the bounds of the image
        :param drag_rect: Drag rectangle
        :return: Cropped rectangle
        """
        x = drag_rect.x()
        y = drag_rect.y()
        w = drag_rect.width()
        h = drag_rect.height()
        if x < 0:
            w += x
            x = 0
        if y < 0:
            h += y
            y = 0
        if x + w > self.pixmap_src.width():
            w = self.pixmap_src.width() - x
        if y + h > self.pixmap_src.height():
            h = self.pixmap_src.height() - y

        return QRectF(x, y, w, h)

        Crop a rectangle to the bounds of the image
        :param drag_rect: Drag rectangle
        :return: Cropped rectangle
        
Crop a rectangle to the bounds of the image
Crop a rectangle to the bounds of the image
def calc_crop_rect(self, drag_rect: QRectF):
        x = drag_rect.x()
        y = drag_rect.y()
        w = drag_rect.width()
        h = drag_rect.height()
        if x < 0:
            w += x
            x = 0
        if y < 0:
            h += y
            y = 0
        if x + w > self.pixmap_src.width():
            w = self.pixmap_src.width() - x
        if y + h > self.pixmap_src.height():
            h = self.pixmap_src.height() - y
        return QRectF(x, y, w, h)
def calc_crop_rect ( self , drag_rect : QRectF ) : x = drag_rect . x ( ) y = drag_rect . y ( ) w = drag_rect . width ( ) h = drag_rect . height ( ) if x < 0 : w += x x = 0 if y < 0 : h += y y = 0 if x + w > self . pixmap_src . width ( ) : w = self . pixmap_src . width ( ) - x if y + h > self . pixmap_src . height ( ) : h = self . pixmap_src . height ( ) - y return QRectF ( x , y , w , h )
Crop a rectangle to the bounds of the image
Crop a rectangle to the bounds of the image
"""
        Crop a rectangle to the bounds of the image
        :param drag_rect: Drag rectangle
        :return: Cropped rectangle
        """
None
self
drag_rect
QRectF
None