Stylesheet problem with background (very basic)
-
Hi
My name is Marcelo. I am new to Qt and I have a very basic problem.
I when I add a background image to the window, all objects take on that image. How do I get just the background image has the window?
I do not want the background image on the buttons. I just want the background image in the window.
http://img254.imagevenue.com/img.php?image=183552445_screenshot_122_347lo.jpg
Tanks!!!
-
You need to tell it to only apply itself to the main window:
QMainWindow { background-image: url(:Escritorio/back.jpg); }
If you wanted to limit it to the push buttons you would use QPushButton, or to a particular
push button QPushButton#pushButton_2.Hope this helps.
-
Tanks for your reply!
I use QPushButton. I had tried its code and does not work. Please see image:
-
The About code works for me using
setStyleSheet
.setStyleSheet("QMainWindow { background-image: url(:/icon/Icon.jpg); }");