I can't replace "<" to "<"
-
It's simple
QString text= "This is a message test < > < > > > < < < <<< >> jan<d>epora"; text.replace("<","<");
It's doesn't work, but with "&l;" or other word it works. Is this a bug?
Thanks in advance
-
Hi,
What do you mean by doesn't work ? What output are you expecting ?
-
@SGaist Hi, i expect this output:
"This is a message test < > < > > > < < < <<< >> jan<d>epora";
It's incredible, but it works replacing with other word.
-
@SGaist Ahhhh, damn, i know what is the $%&/ problem, i use this to test my program:
QMessageBox::information(0,"Test",text);
If i use:
QMessageBox::information(0,"Test","<");
the output is "<"
Damn, 3 hours for this, i hate and love Qt
-
Hi @Brikinhos ,
@SGaist Ahhhh, damn, i know what is the $%&/ problem, i use this to test my program:
This is documented in the QMessageBox class reference (see the section called "Rich Text and the Text Format Property").
Anyway, I recommend converting with QString::toHtmlEscaped() and testing with qDebug():
#include <QDebug> // ... QString text = "This is a message test < > < > > > < < < <<< >> jan<d>epora"; qDebug() << text.toHtmlEscaped();
-
@JKSH Thank you very much, it works with qDebug()