Proprietary stylesheet for a button in external stylesheet file
-
Hi
I'm loading an external style sheet file for my form.
this is code :
@
QPushButton{
background: transparent;
color: white;
}QPushButton QPushButton:on{
background: transparent;
color: white;
}
@How can i set this style sheet for just one button with name btngo ?
-
So in this case
@
qApp->findChild<QPushButton*>("btngo")
@
seems to return the wrong button (or none at all). Is the button really called btngo? What's returned by ui->btngo->name()?
Further, try using the findChild not on qApp but on your main window (or the window which contains the button) instead.//EDIT: Ah now I think I get it, you want to define inside the CSS file which button name to style, right? I don't know of a Qt-way to do that. Maybe you should parse the CSS file yourself and add some extended syntax which then uses the findChild function to apply it to a QWidget with the specified name.
-
[quote author="DerManu" date="1338837244"]So in this case
//EDIT: Ah now I think I get it, you want to define inside the CSS file which button name to style, right? I don't know of a Qt-way to do that. Maybe you should parse the CSS file yourself and add some extended syntax which then uses the findChild function to apply it to a QWidget with the specified name.[/quote]yes right.
i fixed it with parsing string.
thanks a lot.