From a20406dc39fa1bae08863a0cf1551dd38336e6bf Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Wed, 10 Aug 2022 22:08:40 +0800 Subject: [PATCH] custom icon generate --- dictionary.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dictionary.cc b/dictionary.cc index 0a3aa572..b7807c74 100644 --- a/dictionary.cc +++ b/dictionary.cc @@ -293,6 +293,8 @@ bool Class::loadIconFromText( QString const & text ) painter.drawImage( QPoint( img.width() == max ? 0 : ( max - img.width() ) / 2, img.height() == max ? 0 : ( max - img.height() ) / 2 ), img ); + painter.setCompositionMode(QPainter::CompositionMode_DestinationOut); + QFont font = painter.font(); //the text should be a little smaller than the icon font.setPixelSize( iconSize * 0.6 );