PDA

View Full Version : Problems to display a QFont in a View/Model correctly



NoRulez
8th July 2009, 12:26
Hey @all,

i have translations for some languages. Some languages has there own font, for Example: Korean, Chinese, ... All other languages has "Arial" as their default font.

So, if I load the translator for english everthing works fine, but when i choose the chinese translation for example than it seems that all other languages in the listview aren't shown with the font "Arial".

To add the fonts to the model i use something like:


QString translated_text = QApplication::translate("Languages", "LanguageName");
model->addData(model->index(row, column), translated_text, Qt::DisplayRole);

// If translation is english
model->addData(model->index(row, column), QFont("Arial", 12), Qt::FontRole);

// If translation is chinese
model->addData(model->index(row, column), QFont("SimSun", 12), Qt::FontRole);


Could any body help me?

Best Regards
NoRulez