I’m just starting out with Qt4 and C++ and came up with this semi-useful little tool for marking up Egyptian hieroglyphs in MdC.
So far the only annoying Qt-quirk I’ve found is the lack of support for non-BMP unicode characters in the QChar type. Turns out you need to use a QString with two QChars, which is exactly the situation which QChar is supposed to solve (by being larger than 8 bits so that there is a 1-1 correspondence between written characters and QChars in a string).
The unfortunate hack I had to put in for fetching a hieroglyph from a codepoint looked like this:
/**
* Return a QString from a unicode code-point
**/
QString MainWindow :: unicode2qstr(uint32_t character) {
if(0x10000 > character) {
/* BMP character. */
return QString(QChar(character));
} else if (0x10000 <= character) {
/* Non-BMP character, return surrogate pair */
unsigned int code;
QChar glyph[2];
code = (character - 0x10000);
glyph[0] = QChar(0xD800 | (code >> 10));
glyph[1] = QChar(0xDC00 | (code & 0x3FF));
return QString(glyph, 2);
}
/* character > 0x10FFF */
return QString("");
}
The Qt developer tools get a 10/10 from me though. I say this mainly because glade runs like a slug at the best of times.