QPainter p( this );QPainterPath pPath;pPath.addText( QFontMetrics( font() ).boundingRect( fillRect_, Qt::AlignCenter, text_ ).bottomLeft(), font(), text_ );int penSize;if( font().pointSize() < 5 ) penSize = 0;else penSize = qMax( penSize = font().pointSize() / 10, 1 );p.setPen( QPen( Qt::black, penSize ) );p.setBrush( Qt::red );p.drawPath( pPath );
public static void drawBorderedString(Graphics g, String outString, int x, int y, int anchor, int color, int borderColor) { g.setColor(borderColor); for(int shiftY = -1; shiftY <= 1; shiftY++) { for(int shiftX = -1; shiftX <= 1; shiftX++) { g.drawString(outString, x + shiftX, y + shiftY, anchor); } } g.setColor(color); g.drawString(outString, x, y, anchor); }