[PyQt] set qlineedit red, easy??

Frédéric frederic.mantegazza at gbiloba.org
Thu Feb 5 11:50:19 GMT 2009


Le 5/2/2009, "Knapp" <magick.crow at gmail.com> a écrit:

>I have a qlineedit that I want to turn the background red when the
>input is bad but I can't seem to find how to do this. I would think it
>would be easy but it does not seem to be. unless I missed something.

Using a stylesheet?

css = """QLineEdit {
     background-color: red;
}"""
myWidget. setStyleSheet(css)

I didn't test...

http://doc.trolltech.com/4.4/stylesheet.html#overview
http://doc.trolltech.com/4.4/qwidget.html#styleSheet-prop
http://doc.trolltech.com/4.4/stylesheet-examples.html#customizing-qlineedit

--
   Frédéric



More information about the PyQt mailing list