fix:if the applciation has a very large icon ,the application will crash

This commit is contained in:
YiFang Xiao 2022-04-17 20:37:36 +08:00
parent a4c1e2793a
commit 0ea3ad0149

View file

@ -243,12 +243,14 @@ bool Class::loadIconFromFile( QString const & _filename, bool isFullName )
{
// Load successful
//some icon is very large ,will crash the application.
img = img.scaledToWidth( 48 );
// Apply the color key
img.setAlphaChannel( img.createMaskFromColor( QColor( 192, 192, 192 ).rgb(),
Qt::MaskOutColor ) );
dictionaryNativeIcon = QIcon( QPixmap::fromImage( img ) );
dictionaryNativeIcon = QIcon( QPixmap::fromImage( img ));
// Transform it to be square
int max = img.width() > img.height() ? img.width() : img.height();