qtnewbi3
21st October 2011, 20:41
Hi,
I have already used the designer to give a pushbutton the following stylesheet and tested that it works.
QPushButton {
border-image: url(:/Images/a.png);
font: 75 13pt "Droid Serif [unknown]";
color:black;
}
QPushButton:pressed {
border-image: url(:/Images/b.png);
color: darkred;
}
I was trying to make sure that if a button is clicked it stays the in the pressed state in terms of color and background image and font so as to give the illusion that it is selected.
To do this i used the following command in my style sheet.
button->setStylesheet(setStyleSheet(QString::fromUtf8("border-image: url(:/Images/b.png);color: darkred;font: 75 13pt;"));
I dont know where to put the font name ie "Droid Serif [unknown]" as the quotation marks confuse the program if i do it in the same manner as the designer. I have tried appending it as a separate string but it doesnt work. Could anyone give me an example of using the setstylesheet with similar parameters and also setting the font.
Thanks
I have already used the designer to give a pushbutton the following stylesheet and tested that it works.
QPushButton {
border-image: url(:/Images/a.png);
font: 75 13pt "Droid Serif [unknown]";
color:black;
}
QPushButton:pressed {
border-image: url(:/Images/b.png);
color: darkred;
}
I was trying to make sure that if a button is clicked it stays the in the pressed state in terms of color and background image and font so as to give the illusion that it is selected.
To do this i used the following command in my style sheet.
button->setStylesheet(setStyleSheet(QString::fromUtf8("border-image: url(:/Images/b.png);color: darkred;font: 75 13pt;"));
I dont know where to put the font name ie "Droid Serif [unknown]" as the quotation marks confuse the program if i do it in the same manner as the designer. I have tried appending it as a separate string but it doesnt work. Could anyone give me an example of using the setstylesheet with similar parameters and also setting the font.
Thanks