Search code examples
qtgradientqheaderview

How to disable auto gradient effect in QHeaderView?


I have type some code to fill the whole QTreeWidget with single color:

myTree->setStyleSheet("border: 1px solid green; background: green;");

But as a result, the header color is not a solid color. Instead, the header has a gradient with two contrast lines.

How can I disable this effect and fill the header with a solid color? enter image description here


Solution

  • QHeaderView::section {border: 0px solid green; background: green;}
    

    It's working.

    https://forum.qt.io/topic/101700/how-to-disable-auto-gradient-effect-in-qheaderview/2