Skip to content

Commit

Permalink
fix:if the applciation has a very large icon ,the application will crash
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Apr 17, 2022
1 parent a4c1e27 commit 0ea3ad0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dictionary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 0ea3ad0

Please sign in to comment.