I want to set a text in a QLabel
so I need to use a QString
.
But I read a file and the text contains accents.
I tried with QString::fromUtf8()
but it doesn't work.
Any idea?
string line;
QString lineTranslate;
getline(file, line);
lineTranslate = QString::fromStdString(line);
m_nomCourant->setText(QString::fromLatin1("<u><strong>Nom courant :</strong></u> ") + lineTranslate);
Desired output:
Nom courant : Requin
Nom scientifique : Carcharhinus menalopterus
Habitat : Côtier / Dans les zones coralliennes jusqu'à -30m
Famille : Carcharhinidés
Actual output:
Nom courant : Requin
Nom scientifique : Carcharhinus menalopterus
Habitat : C?tier / Dans les zones coralliennes jusqu'? -30m
Famille : Carcharhinid?s
Edit: What do you advise me to use to have a QString
with several lines?
– Morb Apr 28 '15 at 07:22