KanadaKid
27th December 2009, 06:48
Hey,
I'm using Qt4 on Mac OS X. I'm trying to set an image as the background for my main window, and also I want that image to show through all the child widgets so it creates a uniform background. Basically, I want for all child widgets in the main window to have transparent backgrounds, so that the main window's background image shows through. I tried the following:
// called from constructor of my QMainWindow-derived class
setStyleSheet("background-image: url(some_bg.png)");
This basically works, however, EVERY child widget attempts to set this image as its own background. That is, instead of having one, uniform background, I get several partial images as each widget uses that image as its own background. Such as a QLabel, which for some reason draws its normally gray background using that same image. How can I achieve the aforementioned results, where the child widgets let the main window background image simply show through?
Thanks!
I'm using Qt4 on Mac OS X. I'm trying to set an image as the background for my main window, and also I want that image to show through all the child widgets so it creates a uniform background. Basically, I want for all child widgets in the main window to have transparent backgrounds, so that the main window's background image shows through. I tried the following:
// called from constructor of my QMainWindow-derived class
setStyleSheet("background-image: url(some_bg.png)");
This basically works, however, EVERY child widget attempts to set this image as its own background. That is, instead of having one, uniform background, I get several partial images as each widget uses that image as its own background. Such as a QLabel, which for some reason draws its normally gray background using that same image. How can I achieve the aforementioned results, where the child widgets let the main window background image simply show through?
Thanks!