how to create a qt QTButton with multiple colors?

160 views Asked by At

I am looking for how to create a QT button with multiple color in background color.

Button should look like this

enter image description here

1

There are 1 answers

0
eyllanesc On BEST ANSWER

Use a gradient:

button->setStyleSheet(R"(
    background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 102, 255), stop:0.55 rgba(0, 148, 61, 255), stop:0.98 rgba(0, 255, 0, 255), stop:1 rgba(0, 0, 0, 0));
    border-radius:  10px;
)");

enter image description here