set different background colors on qt widget

  • Somehow I need to set two different background colors(for example: 50-50) on a qt widget. Is it possible?

  • @JoeCFD I don't think it's possible with a default qwidget. You could use a gradient in a stylesheet but that's not a 50/50. It's possible there is some css trick that could do it, but I'm not very good with css. And Qt doesn't handle pure css but more of just the pieces it cares about. So even if there is a css trick it may not work.

    You can also derive from qwidget and handle your own background drawing, in which case doing the 50/50 is very easy.

  • got it. Thanks.

Log in to reply