Using a global stylesheet to manage the fill color of QStyleOptionButton



  • So I have a QStyleOptionButton that exists in a CheckBoxDelegate which manages a column in a QTableView. I am using a global stylesheet to manage the highlighted color of the rows in the tableview. The problem is that the QStyleOptionButton does not display the colors from the stylesheet. I have to hardcode the color with painter->fillRect() in order to get the output I want.

    Any ideas as to how I could have my global stylesheet manage the color of the QStyleOptionButton?


  • Lifetime Qt Champion

    Hi,

    The style sheet handling uses a custom internal style so you'll need to re-parse it yourself in your delegate or an alternative could be to have a setter in your delegate to change that colour and handle the style sheet parsing in your main widget.

    Hope it helps


Log in to reply