Qt World Summit: Submit your Presentation

Unicode \u25c0 works on Mac but not Windows in button text

  • I need to use a Unicode character in my cross-platform application. The following code works on the Mac, but results in ? being displayed on a Windows 10 PC:
    ui->continueWithAnalysisButton->setText("Proceed to Analyze \u25B6");

    Based on looking at other posts, I have tried a number of variations on this but so far no success.


  • @buckler Hi! Are you sure that the symbol is in the font you're using on Windows? Is it in this list: http://www.fileformat.info/info/unicode/char/25c0/fontsupport.htm?

  • Thank you Wieland!

    After some more digging it seemed not that the character was not in the font as much as it is 16 rather than 8 bit, QChar can do 16 bit but not the \u sequence? In any case, here is the solution that worked in the end:

    Instead of

    • ui->backToDefineButton->setText("\u25C0");
    • ui->proceedToReportButton->setText(tr("Proceed to Report \u25B6"));

    I instead coded:

    • ui->backToDefineButton->setText(QChar(0x25C0));
    • QString buttonText = tr("Proceed to Report ");
    • buttonText.append(QChar(0x25B6));
    • ui->proceedToReportButton->setText(buttonText);

    which now works on both Mac and Windows.

    Thanks for the help!

  • @buckler The following should do, too:

    QString::fromUtf8("Some text \u25c0");

  • @Wieland I had tried that, but it was not effective... it seems to need the QChar solution.

  • Just tested it. The solution in your initial posting works for me with MinGW 32 bit but not with MSVC 2015 64 bit.

    The following works with both compilers (and also with gcc on Linux):


Log in to reply