From 0ea3ad0149b47679e4947975175fc7f9b303420c Mon Sep 17 00:00:00 2001 From: YiFang Xiao Date: Sun, 17 Apr 2022 20:37:36 +0800 Subject: [PATCH] fix:if the applciation has a very large icon ,the application will crash --- dictionary.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dictionary.cc b/dictionary.cc index 5a20875f..7ccc36e2 100644 --- a/dictionary.cc +++ b/dictionary.cc @@ -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();