image's parent is being passed to child widget..
-
@1XU7 CSS stands for Cascading Style Sheets, meaning when you set a property on an instance it cascades down the children tree.
Your solution works, but is kinda intrusive. You shouldn't change buttons style to set a QFrame style. A better solution would be to give the frame object a name using
setObjectName()
or via property editor in designer and then only set the style for that:#MyFrame { border-image: url(:/imgs/resources/imgBanner.png); }
-
Auto-answering... i found the correct way, i post here the solution for people who need to fix this as me...
just needed to set stylesheet in QFrame parent only.. for all childs too..
In QFrame:
QFrame { border-image: url(:/imgs/resources/imgBanner.png); } QPushButton { background-color: rgb(85, 255, 255); color: rgb(0, 0, 0); }
thanks anyway!
-
@1XU7 CSS stands for Cascading Style Sheets, meaning when you set a property on an instance it cascades down the children tree.
Your solution works, but is kinda intrusive. You shouldn't change buttons style to set a QFrame style. A better solution would be to give the frame object a name using
setObjectName()
or via property editor in designer and then only set the style for that:#MyFrame { border-image: url(:/imgs/resources/imgBanner.png); }
-
-
@Chris-Kawa thanks, that is even more elegant!!
Just was wondering my solution is bad, because, what happens if i had more than one QFrame?.. or more than one button?.. the style will be changed for all of them...
but identifying as you said then that problem will gone..