Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How can change the color of the button when the page background-image is changed?



  • I use stackedWidget and set the background-image of each page by right click on it and choose ->change style sheet -> add resource ->background-image but the color of button, text edit & ..... which are in the page change and take the background color of the page , when I want to change the style sheet of button,text edit & ....(with right click on it) it does n't change,how can change the color of the button when the page background-image is changed?


  • Lifetime Qt Champion

    Hi
    StyleSheet are cascading so it will affect all children also,
    unless you use names or other selectors to
    specify which widgets you mean.

    http://doc.qt.io/qt-5/stylesheet-examples.html#style-sheet-usage
    Read the section about selectors


Log in to reply