I am trying to change the color of QPushButton to QPalette::Accent, but the color does not change.
At first I tried to do it this way:
QPushButton button("Apply");
QPalette palette = QPalette();
palette.setColor(QPalette::Button, palette.color(QPalette::Accent));
button.setPalette(palette);
button.setAutoFillBackground(true);
But I only got this:

When I tried to use stylesheet I got a button that lost its macOS style
QPushButton* button = new QPushButton("open");
button->setStyleSheet("background-color: rgb(255,255,0);");

But I want to achieve this result:

I apologize for the stupid question, but I have already searched the entire Internet, and I don’t know how to do it.
>Solution :
A blue button in MacOS, like in your example "button3", indicates that this is a default button. So, e.g. pressing Enter will press this button.
To achieve the same behavior (and look), you should simply call button.setDefault(true). This might be restricted to dialog windows.
Coloring the button blue without making it the default button would mislead the user.