PDA

View Full Version : How to input text working css properties?



enerdswe
16th September 2012, 20:20
Hi!
I just made some "QLineEdit" and want to give the text that I put inside those "QLineEdit"'s, with CSS.

I want another color and put som CSS shadow for it, can someone tell me how, getting so tired trying :(

Cheers!

ChrisW67
16th September 2012, 22:47
A Qt style sheet is not CSS although it has many similarities. Text in a different colour is trivial and you probably want to tweak the selection highlight colour also:


#include <QtGui>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QLineEdit l;
l.setStyleSheet(
"QLineEdit { "
"color: red; background-color: white; "
"selection-color: white; selection-background-color: red; }" );
l.show();
return app.exec();
}


As far as I can see Qt Style Sheets do not have any equivalent of the CSS3 text-shadow property.