Display "Error" in QLineEdit
-
Hi!
I´d like to display the word "Error" in color "red" in QLineEdit "edit2" if someone enters a number > 1 in QLineEdit "edit1".
I tried:
@
double number = edit1->text().toDouble(&ok);
...if(number > 1.0)
{
QString error = "<span style='color: red'>Error</span>";
edit2->setText(error);
}//Remark: edit1 and edit2 are introduced as pointers:
QLineEdit *edit1;
QLineEdit *edit2;
@which didn´t work. If you see the problem, please tell!
-
Don't forget to save old palette and return to it, when you will show another message in edit2 :)