How to organize Qt Stylesheet (qss) to avoid stylesheet overriding

409 Views Asked by At

On my project I have a lot of custom widgets and everything(buttons, windows, labels, combos, etc) is styled individually according to the visual theme of the project. Because of this my *.qss file is very big(aprox. 2500 lines) and unmaintainable. Considering all above:

  1. I need a way of splitting/organise the stylesheet code such that it's easier to maintain but at the same time to make sure that the style is set only once for the entire application.
  2. Implement first point in a way that avoids styles to be overwritten when you pas a parent to a widget (avoid style inheritance and use of ">" selector).

Are there any "good practices" to achieve a better organised and easier to maintain stylesheet when using widgets?

0

There are 0 best solutions below