Greetings,

I want to display the '<' character within some HTML text in a QMessageBox. It appears that Qt views the '<' character as the start of a tag and doesn't display it.

Displaying the following in a browser does work.
Qt Code:
  1. <html><</html>
To copy to clipboard, switch view to plain text mode 

Does anyone know if this is even possible in Qt?

The following code works for any characters I use except '<'.
Qt Code:
  1. QString str( QString( "Restricted characters found in device name: \"%1\"<br>" ).arg( sTypedName ) );
  2. QString str2( QString( "Device name \"%1\" will become \"%2\".<br>" ).arg( sOldName ).arg( sNewName ) );
  3. str.append( "<DIV align=\"center\"><TABLE>" );
  4. str.append( "<TR><TD> Restricted:</TD><TD><b><</b></TD><TD><b>></b></TD></TR>" );
  5. str.append( "<TR><TD>Replacement:</TD><TD><b>[</b></TD><TD><b>]</b></TD></TR>" );
  6. str.append( "</TABLE></DIV><br>" );
  7. str.append( str2 );
  8. int rVal = QMessageBox::warning( this, tr("Restricted Characters Found"), str,
  9. QMessageBox::Ok, QMessageBox::Cancel );
  10. if ( rVal == QMessageBox::Cancel )
  11. return false;
  12.  
  13. return true;
To copy to clipboard, switch view to plain text mode