PDA

View Full Version : setWritingSystem gives "out of range" error



jano_alex_es
2nd October 2009, 11:33
Hi, I'm having problem when I try to add a filter.

I have a QDialog which controls the font of a text, it has a QFontComboBox for the family, a QComboBox for the size and another for the writingSystem.

I want to change the QFontComboBox, appling a filter, depending of which writingSystem is selected.

It's a pretty clear code, and it gives an strage "out of range" problem when I execute.



void CFontsDialog::combBWritSystemsChanged( QString strWrtSystems )
{//strWrtSystems is the selected writingSystem in the comboBox
QFontDatabase::WritingSystem auxWrSystem = ui.m_combBFamilies->writingSystem();

QFontDatabase database;
QList<QFontDatabase::WritingSystem> lWrSys = database.writingSystems();
for(int i = 0; i < lWrSys.size(); ++i)
{
if(QFontDatabase::writingSystemName(lWrSys.at(i)) == strWrtSystems)
{
auxWrSystem = lWrSys.at(i); //this line is always executed, the variable is valid
break;
}
}
ui.m_combBFamilies->setWritingSystem(auxWrSystem); //error, but the variable seems right :S
}


any clue? thanks!