Important: Please read the Qt Code of Conduct -

QTextBrowser display special char issue

  • Hi! I want to replace - (dashes) with • (bullets) in the QTextBrowser text.

    ui->textBrowser->setText(QString("-ABCD").replace("-", "\0x2022"));

    It displays text without any special character. How to fix it? Thanks.

  • I have fixed it by replacing "\0x2022" to "\u2022" with QStringLiteral macro.


    ui->textBrowser->setText(QString("-ABCD").replace("-", QStringLiteral("\u2022")));

    Now all works well.

Log in to reply