I have a Unicode problem. The German Letters ä
, ü
, ö
and ß
are only visible as a white question mark in a black rhombus. I've made a QAbstractTableModel
in Qt5.5.1.
My document is UTF-8 coded. I already tried this, but I still get the same problem.
QVariant bodyPartModel::data(const QModelIndex &index, int role) const
{
switch (role){
case Qt::DisplayRole:
if (col == 0 && row == 0) return tr("ü");
if (col == 0 && row == 2) return String::fromUtf8("ä");
//
}
Does anyone have a clue as to how to display these characters correctly?
edit.: Yes i need a String, i just used one char in this example.
And Thanks to Adriano Repetti, this was the Solution:
QString::fromWCharArray(L"Steißbein")