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.
<html><</html>
<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 '<'.
QString str
( QString( "Restricted characters found in device name: \"%1\"<br>" ).
arg( sTypedName
) );
QString str2
( QString( "Device name \"%1\" will become \"%2\".<br>" ).
arg( sOldName
).
arg( sNewName
) );
str.append( "<DIV align=\"center\"><TABLE>" );
str.append( "<TR><TD> Restricted:</TD><TD><b><</b></TD><TD><b>></b></TD></TR>" );
str.append( "<TR><TD>Replacement:</TD><TD><b>[</b></TD><TD><b>]</b></TD></TR>" );
str.append( "</TABLE></DIV><br>" );
str.append( str2 );
int rVal
= QMessageBox::warning( this, tr
("Restricted Characters Found"), str,
return false;
return true;
QString str( QString( "Restricted characters found in device name: \"%1\"<br>" ).arg( sTypedName ) );
QString str2( QString( "Device name \"%1\" will become \"%2\".<br>" ).arg( sOldName ).arg( sNewName ) );
str.append( "<DIV align=\"center\"><TABLE>" );
str.append( "<TR><TD> Restricted:</TD><TD><b><</b></TD><TD><b>></b></TD></TR>" );
str.append( "<TR><TD>Replacement:</TD><TD><b>[</b></TD><TD><b>]</b></TD></TR>" );
str.append( "</TABLE></DIV><br>" );
str.append( str2 );
int rVal = QMessageBox::warning( this, tr("Restricted Characters Found"), str,
QMessageBox::Ok, QMessageBox::Cancel );
if ( rVal == QMessageBox::Cancel )
return false;
return true;
To copy to clipboard, switch view to plain text mode
Bookmarks