certain image will cause application to crash

related to qtbug https://bugreports.qt.io/browse/QTBUG-105265
This commit is contained in:
Xiao YiFang 2022-07-31 10:27:31 +08:00
parent 277b90657d
commit 25c9c38e96

View file

@ -246,9 +246,10 @@ bool Class::loadIconFromFile( QString const & _filename, bool isFullName )
//some icon is very large ,will crash the application. //some icon is very large ,will crash the application.
img = img.scaledToWidth( 48 ); img = img.scaledToWidth( 48 );
// Apply the color key // Apply the color key
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
img.setAlphaChannel( img.createMaskFromColor( QColor( 192, 192, 192 ).rgb(), img.setAlphaChannel( img.createMaskFromColor( QColor( 192, 192, 192 ).rgb(),
Qt::MaskOutColor ) ); Qt::MaskOutColor ) );
#endif
dictionaryNativeIcon = QIcon( QPixmap::fromImage( img )); dictionaryNativeIcon = QIcon( QPixmap::fromImage( img ));