Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Why does background-image displays on top of background-color in QPushButton?
mmesarina last edited by
I set the stylesheet property of my MainWindow to load an image for the background of the window with setStyleSheet(), but that caused the QPushButtons in the entire project to display the same image as background, because I pressume setting the parent window's background-image property is automatically passed to the QPushButton's properties.
So , since I wanted the buttons to show as background a color and not an image, I set the background-color of the QPushbuttons to a color, but the color shows behind the image.
Can someone tell me how I could solve this problem.
I just want my buttons to show a background color not an image, but setting the background-image property on the MainWidnow makes the buttons adopt the image.
giesbert last edited by
I assume, that the style sheet is incorrect.
if you set a a "selector":http://doc.qt.nokia.com/4.7/stylesheet-syntax.html only widgets which fit thge selector get the property.
sets the beckground image to all QTextEdit, QListView and from those classes derived classes.
sets the beckground image to all QWidget derived classes, which means to all widgets.