background-color stylesheet doesn't work on centralwidget
Solved
General and Desktop
-
Hi, so when I try to change background color of centralwidget in the Design tab, it works, but when I try to do it as a command, it doesn't work.
Here's the code I used for the stylesheet:ui->centralwidget->setStyleSheet("color: white;" "background-color: rgb(241, 243, 231);");
-
In the Qt docs they recommend using palette for setting background color.
I'm using this code:centralWidget()->setAutoFillBackground( true ); QPalette p=centralWidget()-> palette(); p.setColor(QPalette::Background, YOUR_COLOR); centralWidget()-> setPalette(p);
-
Hi,
Do you have any other stylesheet that you apply in this widget ?
-
In the Qt docs they recommend using palette for setting background color.
I'm using this code:centralWidget()->setAutoFillBackground( true ); QPalette p=centralWidget()-> palette(); p.setColor(QPalette::Background, YOUR_COLOR); centralWidget()-> setPalette(p);