Important: Please read the Qt Code of Conduct -

How to apply different styling to TreeWidget Parent and Child nodes?

  • Trying to format TreeWidget nodes where Base Nodes/Parents are root level nodes and they may or may not have any children. Ran into following issues:

    1. The base Nodes/Parents need to have Bold fonts: Tried "font-weight: bold;" but it doesn't work?

    2. Want to increase spacing between base Nodes/Parents because they are too close together. Tried "padding: 6x;" and margin but they didn't work?

    3. Want to adjust indendation (left-spacing for each level). Tried adjusting indentation property in QtDesigner, but it moves all nodesto the right, child nodes move much more than parents? Can I set indentation for each level?

  • @Taytoo
    For 1 & 2, I don't know whether stylesheet will work. How did you actually apply the stylesheet to what (show code)? Are you wedded to using stylesheet for this or are you prepared to use delegate style code?

Log in to reply