[SOLVED] Superimpose Qwidget background on QMainWindow background
I have a mainwindow with a Qwidget as the central widget, which in turn consists of serveral widgets. Both the mainwindow and the central widget have a a background image but I'm not able to superimpose the central widget background on the mainwindow background. The central widget background image is translucent so I should be able to see the foggy background image of the mainwindow. The code I'm using now in the mainwindow is
QPalette p = palette();
QDesktopWidget* desktopWidget = QApplication::desktop(); QRect rect = desktopWidget->availableGeometry(); QSize size(rect.width() , rect.height()); QPixmap pixmap(pixmap1.scaled(size)); p.setBrush(QPalette::Background, pixmap); setPalette(p);
CentralWidget *cw = new CentralWidget();
Even if I try to set only the central widget background, the image appears as a background for the widgets inside the central widget and not the central widget as a whole.
I know I have not framed the question very well, but if you are able to understand it, please do help me.
Can you attach an image of the result that you are getting, it will be of help.
Umm, please don't laugh at me. How do I attach a local file from my computer?
Instead of a central widget, I used a QLabel, assigned the layouts to it and set the stylesheet. And it worked!