PDA

View Full Version : QLineEdit - red frame



slava
15th February 2008, 14:07
Is it possible to change the frame color of QLineEdit?
I'm trying to have the red frame when the lineEdit is empy and usual color when the lineEdit is filled. The same with QTextEdit.
Is it possible to do? I have looked through the manual but didn't find it. There is only "setFrame", but nothing about color of a frame.

jpn
15th February 2008, 14:10
Try style sheets: Customizing QLineEdit (http://doc.trolltech.com/latest/stylesheet-examples.html#customizing-qlineedit)

slava
15th February 2008, 14:46
Hey! That worked! Thank you very much!!! :)

But it makes the lineEdit smaller somehow. I have a font set to 12 for the whole application and the other lineEdits are big but that one gets back to 10 px.
I put setFond to 12 after that lineEdit again but that doesn't help. The same with the textEdits...

I did:

lineEdit->setStyleSheet("border: 1px solid red");

slava
16th February 2008, 12:44
I have figured it out. Thank you!:)