C++ (Qt)QGraphicsDropShadowEffect::setOffset( 0, 0 );QGraphicsDropShadowEffect::setBlurRadius( 20 );
QFont font; font.setPixelSize(24); font.setFamily("Arial"); int offset = 2; QString text = "This is test text"; QFontMetrics fm(font); QPixmap styleSource(fm.width(text),fm.height()); styleSource.fill(Qt::transparent); QPainter paint(&styleSource); paint.setPen(Qt::white); paint.setBrush(Qt::white); paint.setFont(font); paint.drawText(1,fm.height(),text); paint.end(); QPixmap source(fm.width(text),fm.height()); source.fill(Qt::transparent); QPainter paint2(&source); paint2.setPen(Qt::red); paint2.setBrush(Qt::red); paint2.setFont(font); paint2.drawText(1,fm.height(),text); paint2.end(); QPixmap img = QPixmap(styleSource.width() + offset * 2, styleSource.height() + offset * 2); img.fill(Qt::transparent); QPainter ppm(&img); QPoint pos(0, 0); pos += QPoint(-offset, 0); ppm.drawPixmap(pos, styleSource); pos += QPoint(offset * 2, 0); ppm.drawPixmap(pos, styleSource); pos += QPoint(-offset, -offset); ppm.drawPixmap(pos, styleSource); pos += QPoint(0, offset * 2); ppm.drawPixmap(pos, styleSource); pos += QPoint(0, -offset); ppm.drawPixmap(pos, source); ppm.end(); painter->drawPixmap(0,0,img);