(self, event)
return super(QResizableImage, self).resizeEvent(event)
Resize the pixmap if it exists, keeping the aspect ratio.
Resize the pixmap if it exists, keeping the aspect ratio.
Resize the pixmap if it exists keeping the aspect ratio .
def resizeEvent(self, event):
        """Resize the pixmap if it exists, keeping the aspect ratio."""
        if self._pixmapOriginal is not None:
            #Test to make a square in the top left corner
            '''
            with self.makeEditable():
                colour = QtGui.QColor(255, 255, 255).rgb()
                for x in range(50):
                    for y in range(50):
                        self.setPixel(x, y, colour)
                        '''
            width = self.width()
            
            size_mult = min(self.width() / self._pixmapWidth, self.height() / self._pixmapHeight)
            self._sizeHint = (self._pixmapWidth * size_mult, self._pixmapHeight * size_mult)
            
            if self.debugMode():
                scaled_pixmap = self._pixmapOriginal.scaled(self.width(), self.height(), QtCore.Qt.IgnoreAspectRatio, self.transformMode())
            else:
                scaled_pixmap = self._pixmapOriginal.scaled(self._pixmapWidth * size_mult, self._pixmapHeight * size_mult, QtCore.Qt.IgnoreAspectRatio, self.transformMode())
            super(QResizableImage, self).setPixmap(scaled_pixmap)

        return super(QResizableImage, self).resizeEvent(event)
def resizeEvent ( self , event ) : if self . _pixmapOriginal is not None : #Test to make a square in the top left corner '''
            with self.makeEditable():
                colour = QtGui.QColor(255, 255, 255).rgb()
                for x in range(50):
                    for y in range(50):
                        self.setPixel(x, y, colour)
                        ''' width = self . width ( ) size_mult = min ( self . width ( ) / self . _pixmapWidth , self . height ( ) / self . _pixmapHeight ) self . _sizeHint = ( self . _pixmapWidth * size_mult , self . _pixmapHeight * size_mult ) if self . debugMode ( ) : scaled_pixmap = self . _pixmapOriginal . scaled ( self . width ( ) , self . height ( ) , QtCore . Qt . IgnoreAspectRatio , self . transformMode ( ) ) else : scaled_pixmap = self . _pixmapOriginal . scaled ( self . _pixmapWidth * size_mult , self . _pixmapHeight * size_mult , QtCore . Qt . IgnoreAspectRatio , self . transformMode ( ) ) super ( QResizableImage , self ) . setPixmap ( scaled_pixmap ) return super ( QResizableImage , self ) . resizeEvent ( event )