Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Applying text-shadow to a QLabel?



  • Hello all,
    is there a way to add a drop-shadow to a text in a QLabel? I have tried using the "text-shadow" attribute in a label-specific style sheet

    @ FirstLabel->setStyleSheet("background-color: rgba(0, 0, 0, 50);"
    "text-shadow: 2px 2px #ff0000;");@

    but that didn't produce anything visible. Did I make an error, or do I have to go about it another way? How can I get shadowed text?

    I'm using Qt 5.2.1 on Ubuntu Linux 14.04 LTS.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    AFAIK text-shadow is not supported by QSS. However you can try with QGraphicsDropShadowEffect

    Hope it helps


Log in to reply