html symbols in tr("") sometimes not correct displayed, QGroupBox, QRadiobutton

  • Hi!

    I would like to display some greek symbols (e.g. for alpha α) as html-Code for example in the heading of a QGroupBox.

    Well, so far here it works:

    QLabel *label = new QLabel(tr("<i>&alpha;</i>:"));
     formLayout->addRow(tr("<i>&tau;</i>"), lineEdit);

    and here it does not work:

    QGroupBox *groupBox = new QGroupBox(tr("&alpha;"));
    radio = new QRadioButton(tr("<i>&alpha;</i>"));

    Has it to do, that it works for:

    1. Qlabel and
    2. QLineEdit

    and not for

    1. QGroupBox and
    2. QRadiobutton

    Or is another class needed for QGroupBox and QRadiobutton?

    Has anyone experiences with this problem?

    Please let me know! Thanks!

  • Lifetime Qt Champion


    Not all classes support html, QLabel and QLineEdit are two special cases.

    For QRadioButton, you can associate it with a QLabel using e.g a QHorizontalLayout.

    Hope it helps

Log in to reply