Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to alternate empty space color in QTreeWidget?



  • If I type this code

    myTree->setAlternatingRowColors(true);
    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

    Hi,

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


Log in to reply