[bt-devel] Qt question

Joachim Ansorg bt-devel@crosswire.org
Fri, 8 Feb 2002 14:08:17 +0100


Hi!

> Should this work for displaying unicode?
>
>      QFont uniFont("unifont");
>      uniFont.setCharSet(QFont::Unicode);
>      textDisplay->setFont(uniFont);

Looks ok, but make sure tzhe font unifont has the charset iso10646-1 in the 
Qt charset fontchooser dialog available.

>                text += QString::fromUtf8(((const char *)*currentText)) +  

This looks good. We do it almost the same way in BibleTime (class CSwordKey).

> I just get squares where greek text should be.  Latin comes out fine.

This happens if the wrong charset is used to display the text or if the etxt 
was not properly converted using the fromLatin1, fromUtf8 functions etc.

BTW, which class do you use to display the text? QTextView or QMultiLineEdit?
Do you use Qt2 or Qt3?

Unicode is a bit tricky in Qt2 if the charset iso10646-1 is not available. 
Let me know if it works. Is the sourcecode available somewhere?

Joachim

P.S.: My login and CVS  doesn't work anymore for crosswire. Have I missed 
some mail.