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")
};
const QVariant ArticleTableModel::header_names[] = {
tr("ID"),
tr("Name"),
tr("Category"),
tr("Unit"),
tr("Amount"),
tr("Prize"),
tr("Tax"),
tr("Information")
};
To copy to clipboard, switch view to plain text mode
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];
}
QVariant ArticleTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role == Qt::DisplayRole && orientation == Qt::Horizontal)
return header_names[section];
return QVariant();
}
To copy to clipboard, switch view to plain text mode
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.
Bookmarks