°C displayed as °C
-
When I use setText for a label like this:
@ui->label_5->setText("°C");@
It is displayed as:
@°C@If I set °C in Qt Designer in the form editor, everything is displayed as it should.
Why is this happening?
-
try this:
@ui->label_5->setText(tr("°C"));@ -
Nope doesn't work.
tr is for translating, why do you think it works for this? -
See "here":http://qt-project.org/doc/qt-4.8/qobject.html#trUtf8 ...
-
Maybe you are saving your files with a wrong enconding? Check it at Options -> Text Editor
-
Changing Encoding doesn't make any changes. TRUTF8 does the job :)
-
Please add [SOLVED] to topic subject.
-
@
void MLineEdit::setLblText2(QString s )
{
label2->setText(s);
}
@Adding trUtf8 here to s doesn't work..
-
Of course not, it only works with static text. You'll have to do the translation wherever s originates.
-
It is an Custom Widget:
Q_PROPERTY( QString Unit READ readLblText2 WRITE setLblText2 DESIGNABLE true SCRIPTABLE true STORED true ) -
should look like this:
@
this->setLblText2(trUtf8("°C"));void MLineEdit::setLblText2(QString s )
{
label2->setText(s);
}
@