Important: Please read the Qt Code of Conduct -

QLabel and Background Transparency

  • I'm using stylesheets to control the overall theme of my application.

    In a number of instances, I have semi-transparent panels (90% transparency) which contain QLabel widgets who have their background-color style property set to be transparent. This works fine up until the point at which the text in the label changes, then the background is no longer transparent.

    If I force a re-paint of the container QWidget, then all becomes clear again (pardon the pun) however, I don't really want to do this parent re-paint every time a label is updated (there are 8 updatable QLabels on this particular QWidget) as it seems a fairly expensive thing to do.

    How can I maintain the transparency of a QLabel even when the text() has changed?

  • Lifetime Qt Champion

    Tried to reproduce it but had no luck.

  • @webzoid You can use setvisible (true) And (False) and make a transparent even when the text has changed

Log in to reply