custom icon generate

This commit is contained in:
Xiao YiFang 2022-08-10 22:08:40 +08:00
parent 9a52a1c616
commit a20406dc39

View file

@ -293,6 +293,8 @@ bool Class::loadIconFromText( QString const & text )
painter.drawImage( QPoint( img.width() == max ? 0 : ( max - img.width() ) / 2, painter.drawImage( QPoint( img.width() == max ? 0 : ( max - img.width() ) / 2,
img.height() == max ? 0 : ( max - img.height() ) / 2 ), img.height() == max ? 0 : ( max - img.height() ) / 2 ),
img ); img );
painter.setCompositionMode(QPainter::CompositionMode_DestinationOut);
QFont font = painter.font(); QFont font = painter.font();
//the text should be a little smaller than the icon //the text should be a little smaller than the icon
font.setPixelSize( iconSize * 0.6 ); font.setPixelSize( iconSize * 0.6 );