我需要将发光效果应用于QLabel
. 黑色文本和白色发光效果(描边效果)。我在谷歌试过但没有运气。
如果有人知道如何应用发光效果,QLabel
请告诉我如何做到这一点。
是的,您可以将其设置在QLabel
:
http://qt-project.org/doc/qt-5/qwidget.html#setGraphicsEffect
您可以在小部件上设置 QGraphicsEffect ,只要您不介意它在 Mac 上不起作用。
label = new QLabel("hello text"));
QGraphicsDropShadowEffect * dse = new QGraphicsDropShadowEffect();
dse->setBlurRadius(10);
label->setGraphicsEffect(dse);
希望有帮助。
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.