PDA

View Full Version : Prblem in stylesheet.



Niamita
21st June 2011, 07:19
Hi

I am changing the stylesheet of button like , it is working fine


button_out->setStyleSheet("color: rgb(200, 127, 66, 255);
font-family: verdana, ms sans serif; font-size: 14pt;
background-color: rgb(203, 202, 203,150);
border-style: outset;border-width: 2px;border-radius: 10px;
border-color: gray"); to change stylesheet on button press it is not giving the desire output.


button_out->setStyleSheet("color: rgb(200, 127, 66, 255);
font-family: verdana, ms sans serif; font-size: 14pt;
background-color: rgb(203, 202, 203,150);
border-style: outset;border-width: 2px;
border-radius: 10px;border-color: gray;
QPushButton:pressed{ background-color:black}");


What is the problem with this.
Waiting for your reply.

stefanadelbert
21st June 2011, 09:17
This should work:


button_out->setStyleSheet("QPushButton { color: rgb(200, 127, 66, 255); font-family: verdana, ms sans serif; \
font-size: 14pt; background-color: rgb(203, 202, 203,150); border-style: outset; \
border-width: 2px;border-radius: 10px; border-color: gray; } QPushButton:pressed { background-color:black; } ");

Rather than setting the stylesheet in this way, on a per-component basis, I highly recommend looking at using a system-wide stylesheet (QSS). See Qt Stylesheet Reference (http://doc.qt.nokia.com/4.7/stylesheet-reference.html).