weaver4
28th January 2020, 15:32
I have an app and on certain components I change the palette slightly. I do this by putting this code in the Widget Constructor that contains the component.
if (darkTheme) {
QPalette p = ui->strStringEdit->palette( );
p.setColor( QPalette::Active, QPalette::Base, darkPalette.color(QPalette::AlternateBase));
ui->strStringEdit->setPalette( p );
}
But when the application loses focus (by going to another application) the colors go back to the original colors. When I select my app again the modifications come back.
How do I freeze the palette?
Thanks,
if (darkTheme) {
QPalette p = ui->strStringEdit->palette( );
p.setColor( QPalette::Active, QPalette::Base, darkPalette.color(QPalette::AlternateBase));
ui->strStringEdit->setPalette( p );
}
But when the application loses focus (by going to another application) the colors go back to the original colors. When I select my app again the modifications come back.
How do I freeze the palette?
Thanks,