2

I need to apply Glow effect to QLabel. Text in Black color and glow effect in white(Stroke Effect). I tried in Google but no luck.

If any one knows how apply Glow effect to QLabel then please tell me How to do that.

LogicStuff
  • 19,397
  • 6
  • 54
  • 74
Saravanan
  • 131
  • 2
  • 13

2 Answers2

12

Yes you can set it on a QLabel:

http://qt-project.org/doc/qt-5/qwidget.html#setGraphicsEffect

You can set a QGraphicsEffect on a widget, as long as you don't mind it not working on a Mac.

label = new QLabel("hello text"));
QGraphicsDropShadowEffect * dse = new QGraphicsDropShadowEffect();
dse->setBlurRadius(10);
label->setGraphicsEffect(dse);

Hope that helps.

phyatt
  • 18,472
  • 5
  • 61
  • 80
-1

I think you're going to be slightly disappointed. To apply an effect, you'll need to use a QGraphicsItem. QLabel isn't. You'll need to use a QGraphicsTextItem inside a QGraphicsScene instead. That probably means you'll need to rebuild your UI if it's already implemented using QWidgets.

john.pavan
  • 910
  • 4
  • 6