Search code examples
qtunicodediacriticsqtablewidgetqstring

How to set umlaut for header in QTableWidget?


I have this command to set label for all headers of a table:

ui.mytable->setHorizontalHeaderLabels(QStringList() << tr("VERTRAG") << tr("DATUM/UHRZEIT") << tr("PRÜFER"));

But this Ü does not appear. I tried to use

ui.mytable->setHorizontalHeaderLabels(QStringList() << tr("VERTRAG") << tr("DATUM/UHRZEIT") << tr("PRÜFER").replace(QString::fromLatin1("Ü"), "&Uuml;"));

and

ui.mytable->setHorizontalHeaderLabels(QStringList() << tr("VERTRAG") << tr("DATUM/UHRZEIT") << tr("PRÜFER").replace(QString::fromUtf8("Ü"), "&Uuml;"));

but it does not work also. How can I solve this?

enter image description here


Solution

  • ok, thank you guys. I have a simple answer. It works with me.

    ui.mytable->setHorizontalHeaderLabels(QStringList() << tr("VERTRAG") << tr("DATUM/UHRZEIT") << QLatin1String("PRÜFER"));