[Qt-interest] QLineEdit font color based upon QValidator status
Andre Somers
andre at familiesomers.nl
Sun Feb 6 12:10:32 CET 2011
Op 6-2-2011 4:05, lbutler3 schreef:
> When QtCreator asks for a directory to put the project in the QLineEdit displays text in red whenever the input is invalid. I'd like to do something similar in my application. I have a QValidator-derived class assigned to my QLineEdit that can determine the status of the input, but what is the "right" way to get the QLineEdit to change font color based upon this status?
Sean already gave you the answer on how to do it at the moment. It would
be very cool if you could simply use a stylesheet to do it using a set
of pseudo states. I suggested that in the bugtracker quite a while ago,
but I doubt it will get implemented. It would make this kind of thing
trivial though...
See http://bugreports.qt.nokia.com/browse/QTBUG-11608
André
More information about the Qt-interest-old
mailing list