PDA

View Full Version : greek symbols



genick bar-meir
17th July 2007, 20:48
Hi everyone,

I am trying to insert a Greek character in to label.
I understand that there should be something to with
utf-8.
I confused how to use used.
Is there a simple example (small code) how to get the Greek character like
delta or theta into a label without using the internationalization.
For example using hex code like \x0022 for copyright.

This code is part of calculator (gas dynamics calculator)
that can be seen at www.potto.org.

thanks in advance.

genick

jacek
17th July 2007, 21:09
If you need a single character, you can use QChar:

label->setText( QChar( 0x0394 ) );
For longer texts, you can use fromUtf8():
label->setText( QString::fromUtf8( "\xce\x91\xce\x92\xce\x93" ) );
The third option is to change the encoding of your source files (note that some compilers might not like this) and use QTextCodec::setCodecForCStrings() and QTextCodec::setCodecForTr().

And finally, you can use English in your sources and then load Greek translation using QTranslator.

genick bar-meir
17th July 2007, 22:44
thanks

it work.http://www.qtcentre.org/forum/images/smilies/tongue.png

genick