i have the above code . what i want is text color shall be red and that text value shall be decided during the run time .
Printable View
You should make an effort to describe the problem and analyse what each step of your code is doing (or not doing). Do this quite often leads to seeing your own mistake.Quote:
what i want is text color shall be red and that text value shall be decided during the run time .
You are discarding the result of the function call at line 2. The value of 'text' at line 4 is the same as line 1.
QString pmsg;
pmsg = tr("<font color = red >Hello qt ..!!.\n"" </font size = 11 >");
ui->label->setText(pmsg);
above code will print the text in red colour
Yes. So?Quote:
above code will print the text in red colour
If you are going to use HTML fragments to do rich text at least try to feed Qt valid HTML. What do you expect the attribute on the element end tag are going to do?