First solution that comes to my mind is to create a QMap<QChar,QChar> with polish diactrics <-> desired characted mapping, and use QString::replace() :
void removeDiactrics
( QString * str
){ foreach
( QChar c, _diactrics.
keys() ){ str->replace(c, _diacrtics[c]);
}
}
void removeDiactrics( QString * str ){
foreach( QChar c, _diactrics.keys() ){
str->replace(c, _diacrtics[c]);
}
}
To copy to clipboard, switch view to plain text mode
This is maybe not the best solution for this problem, and I'd really like to see some comments on this from others.
QValidator is ok if you want to check the string input while user is typing, for example in QLineEdit, and QLocale is used for string <-> numbers conversions in different languages, so I dont see how this may help here. Maybe I undestood you wrong, but I was thinking about diacrtics replacement in any QString object anywhere in program.
Bookmarks