sattu
7th February 2014, 07:11
Hi everyone,
For setting an image as the background image of my QWidget I am using the following code-
this->setAutoFillBackground(true);
QPalette palette = this->palette();
palette.setBrush(this->backgroundRole(), QBrush(QImage("MyImage.jpg")));
this->setPalette(palette);
Now I want to reset my Palette and make my QWidget appear completely Black. How do I do that?
I tried using
QPixMap and QPixMap::fill(Qt::Black) and then setting this PixMap to my Palette, but it didn't work :(
For setting an image as the background image of my QWidget I am using the following code-
this->setAutoFillBackground(true);
QPalette palette = this->palette();
palette.setBrush(this->backgroundRole(), QBrush(QImage("MyImage.jpg")));
this->setPalette(palette);
Now I want to reset my Palette and make my QWidget appear completely Black. How do I do that?
I tried using
QPixMap and QPixMap::fill(Qt::Black) and then setting this PixMap to my Palette, but it didn't work :(