Important: Please read the Qt Code of Conduct -

How to alternate empty space color in QTreeWidget?

  • If I type this code

    myTree->setStyleSheet("QTreeWidget{alternate-background-color: red;background: green;}");

    colors of rows are interleaves. But if a QTreeWidget is not full there is an empty space which has green color. Is there a posibility to brush this space with red when the last row is green?

  • Lifetime Qt Champion


    You would have to calculate that and update the style sheet accordingly.

Log in to reply