I found this in QPushButton Class Reference. "This property's default is false. If this property is set, most styles will not paint the button background unless the button is being pressed. setAutoFillBackground() can be used to ensure that the background is filled using the QPalette::Button brush." Because of this I found the following solution.
First of all I kept the style sheet option for checked
QPushButton:checked{
background-color: green.
}
The I used a palette and set the background color and the setAutoFillBackground function.
palette_red->setColor(window.button->backgroundRole(), QColor(255, 0, 0, 127));
window.button->setAutoFillBackground(true);
window.button->setPalette(*palette_red);
I use the toggle signal to catch changes. When the button is toggle is TRUE the style sheet starts working. To not get double (green over red) colors the setAutoFillBackground has to be turned off again.
window.button->setAutoFillBackground(false);
The not toggled state is nearly the same. I needed to turn on the setAutoFillBackground and set the palette again.
window.button->setAutoFillBackground(true);
window.button->setPalette(*palette_red);
It's a solution, it works but I am still open for further inputs.