Important: Please read the Qt Code of Conduct -

How to remove/change the gradient of QToolButton without setStyleSheet

  • I change the background color of my widget with this

    palette = widget.palette()
    palette.setColor(widget.backgroundRole(), QColor("red"))

    But on a QToolButton the background look more "pink" than "red".
    I try other "QStyleFactory" and some work correctly.
    But if I use the default style on my ubuntu I had a gradient background and I doesn't had my color.

    Can I remove or change the gradient of background.

    PS. I try to change the background with setStyleSheet, it work. But my application always crash after a few change on same widget. I need to change the background color of many widget at the same time and many time on same widget.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Do you have that only on Ubuntu ?

    What desktop environment do you use ?

Log in to reply