PDA

View Full Version : QAbstractTableModel's header not translated



Prototyp144
10th June 2013, 20:24
Hello there,

i've got a problem with an inherited class on base of QAbstractTableModel. The headers are defined like this:


const QVariant ArticleTableModel::header_names[] = {
tr("ID"),
tr("Name"),
tr("Category"),
tr("Unit"),
tr("Amount"),
tr("Prize"),
tr("Tax"),
tr("Information")
};

and called like this


QVariant ArticleTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role == Qt::DisplayRole && orientation == Qt::Horizontal)
return header_names[section];
return QVariant();
}

Like mentioned above, the strings are not translated correctly, although all values are translated in a language file, which is loaded fine, becaus all other parts are translated right. Only the headers of all of my inherited classes of QAbstractTableModel are _not_ translated.