[Interest] StyleSheets in children QWidgets

norulez at me.com norulez at me.com
Thu Feb 23 13:32:23 CET 2012


You can use something like the following for only the button with the object name (mybutton):

QPushButton#mybutton {
    border: 2px solid gray;
    border-radius: 3px;
}


In the code you must use:
pButton->setObjectName("mybutton");

But I recommend that you have a look on QStyle.

Best Regards


Am 23.02.2012 um 13:16 schrieb Николай Шатохин <n.shatokhin at gmail.com>:

> So, If I change StyleSheet of CentralWidget then I must change StyleSheets of all children Widgets? So, is it possible to see default stylesheets of widgets? What stylesheet do I must to set to create button with rounded corners and different pictures on click, mouse over, selection, normal and disabled states? And how can I turn off ugly pink selection?
> 
> 2012/2/23 <norulez at me.com>
> This isn't possible. I know there where a hack/workaround but this doesn't work either.
> 
> Best Regards
> 
> Am 23.02.2012 um 12:14 schrieb Николай Шатохин <n.shatokhin at gmail.com>:
> 
> > Hello.
> >
> > When I set custom StyleSheet in CentralWidget or MainWindow, all children widgets and elements lost their default StyleSheets. How to keep default StyleSheets in cheldren elements? And how to disable ugly pink selection in buttons when I change it StyleSheets?
> >
> > Best regards,
> > Nick
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120223/67427ce1/attachment.html>


More information about the Interest mailing list