2

I need to display an HTML text:

QString text="<b>Hello</b>";
QMessageBox::information(this,"info", text);

The text is displayed as bold "Hello". How to display it as it is, i.e.,

<b>Hello</b>

Thanks!

William
  • 761
  • 2
  • 10
  • 27

1 Answers1

3

You have to use the method toHtmlEscaped() of QString:

QString text="<b>Hello</b>";
QMessageBox::information(this, "info", text.toHtmlEscaped());
eyllanesc
  • 235,170
  • 19
  • 170
  • 241