Skip to content
  • Qt Style Sheets cascading classes selectors

    Solved General and Desktop qcss stylesheet
    29
    1 Votes
    29 Posts
    35k Views
    JonBJ
    To summarise for anyone reading this. Thanks to the answers above. You can assign a dynamic property, with a name and value of your choice, via QWidget.setProperty("cssClass", "large"). The stylesheet can match this via selector *[cssClass="large"] { ... }. You can assign multiple values to the property via QWidget.setProperty("cssClass", [ "bold", "large", "rounded" ]). (Or it accepts a space-separated string via "bold large rounded".) The stylesheet can match one of the values via selector *[cssClass~="large"] { ... } (note the ~=). Note that property named class is a special one, referring to the Python/C++ code class of the widget, which you probably should not assign to.
  • 0 Votes
    1 Posts
    714 Views
    No one has replied