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

Does the QLabel use the parents StyleSheet for formatting its rich text (html subset)?



  • I have a label with this text
    @
    "<h1>Hello</h1>"
    @

    and on the labels parent window I have a stylesheet:
    @
    "h1 { font: 89px }"
    @

    However, the h1 style in the label is not affected by it. Any ideas?


  • Lifetime Qt Champion

    Hi,

    AFAIK the style sheet affects the widgets not it's content



  • I guessed something like that. I feel the whole css integration is not finished yet. too many places you still have to hardcode style values in c++ and cannot put everything in css.


  • Lifetime Qt Champion

    Are you maybe mixing two different concepts ?
    You can reuse the widget's font when building your html content but styling a widget is clearly independent of the generated content (i.e the html you put in the label).

    Using a QSS is not the same as using a css to style a web page or html content, it's really only intended to modify the widget's appearance


Log in to reply