Results 1 to 3 of 3

Thread: greek symbols

  1. #1
    Join Date
    Jul 2007
    Posts
    7
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default greek symbols

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: greek symbols

    If you need a single character, you can use QChar:
    Qt Code:
    1. label->setText( QChar( 0x0394 ) );
    To copy to clipboard, switch view to plain text mode 
    For longer texts, you can use fromUtf8():
    Qt Code:
    1. label->setText( QString::fromUtf8( "\xce\x91\xce\x92\xce\x93" ) );
    To copy to clipboard, switch view to plain text mode 
    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.
    Last edited by jacek; 17th July 2007 at 21:16. Reason: typo

  3. #3
    Join Date
    Jul 2007
    Posts
    7
    Qt products
    Qt3
    Platforms
    Unix/X11

    Talking Re: greek symbols


Similar Threads

  1. Replies: 15
    Last Post: 31st January 2020, 18:25
  2. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  3. Display special symbols
    By ShaChris23 in forum Newbie
    Replies: 1
    Last Post: 30th April 2007, 23:51
  4. Linking problems with multiply defined symbols
    By JimBrown in forum Qt Programming
    Replies: 5
    Last Post: 2nd March 2007, 16:48
  5. Undefined symbols in Qtopia
    By minguzzi in forum Installation and Deployment
    Replies: 0
    Last Post: 13th September 2006, 13:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.