Results 1 to 16 of 16

Thread: unable to have greek characters appear in a text Label

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2006
    Posts
    79
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default problem showing greek in .ui.h files in qtDesigner

    Hello everyone..
    i am very confused as to whether i have installed fonts wrongly.. or if there is a limitation in qtDesigner or whatever else it might be:
    here are the facts:

    i run KDE, in slackware 10.2 and from control centre ->regional & accessibility -> keyboard layout, i have added keyboard support for greek (layout), el (keymap).. i have set the layout variant to 'basic'.
    as far as fonts is concerned i copied all of my ntfs (winXP) partition fonts and installed them both in my personal fonts list and in administrator mode (ie system mode).

    in case you are greek and know linux well i note that i do have a little problem that havent managed to solve. it is not in the scope of this email but if you can help me out i would mostly appreciate it. while i can type greek in all applications i can not type vowels with stress (tonos)! how is that even possible? to make things even more confusing i CAN type vowels with stress in mozilla firefox!!!

    then:

    i am programming a greek oriented application.. therefore all of the button texts, label texts etc are to be in greek... so i have filled all the form's object's 'text' fields in qtDesigner with greek characters, as well as done all the setText("/*some text in greek*/") in my .ui.h files.

    the thing is when i type greek in qtDesigner i see greek on the screen so that is fine...
    However, if i close and reopen qtDesigner and look through the .ui.h file wherever there were greek characters they have been replaced with "???????" (no quotes and the questionmarks are in number identical to the number of greek chars that were there before)

    note that greek text in buttons on the form is still shown fine... only the .ui.h have problems...

    any ideas where i should start looking?
    thank you for your help
    nass

  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: unable to have greek characters appear in a text Label

    Please, don't start more than one thread on the same problem.

    What encoding does your system use?

  3. #3
    Join Date
    Jul 2006
    Posts
    79
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: unable to have greek characters appear in a text Label

    by encoding you mean the locale?
    the value of the LC_* variables?
    its en_US

    i started a new topic because i figured that the previous is a subproblem of this topic.. as in if i solve this the previous with automatically work..

  4. #4
    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: unable to have greek characters appear in a text Label

    Quote Originally Posted by nass
    by encoding you mean the locale?
    No, I mean the encoding. Like UTF-8, ISO-8859-2 and similar.

  5. #5
    Join Date
    Jul 2006
    Posts
    79
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: unable to have greek characters appear in a text Label

    how do i get this info?

  6. #6
    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: unable to have greek characters appear in a text Label

    The safest way is to see what Qt thinks:
    Qt Code:
    1. #include "qapplication.h"
    2. #include "qtextcodec.h"
    3.  
    4. int main( int argc, char **argv )
    5. {
    6. QApplication app( argc, argv );
    7.  
    8. qDebug( QTextCodec::codecForLocale()->name() );
    9.  
    10. return 0;
    11. }
    To copy to clipboard, switch view to plain text mode 

  7. #7
    Join Date
    Jul 2006
    Posts
    79
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: unable to have greek characters appear in a text Label

    says here UTF-8...
    but is that directly taken from the Os or KDe or smth?
    cause a while ago i was trying to make my linux recognise UTF-8 using the info on this link
    http://hektor.umcs.lublin.pl/~mikosm...x-unicode.html
    so i started by

    Qt Code:
    1. "export LC_ALL=en_US.UTF-8"
    To copy to clipboard, switch view to plain text mode 

    and then it says

    Applications started afterwards from the same terminal window should be aware of UTF-8. To check if that's the case, you could for example use the command wc. wc -c will tell you the number of bytes and wc -m the number of characters in a file or in data read from standard input (end typing with Enter and Ctrl-D). In a UTF-8 locale, if text contains non-ASCII characters, the number of bytes will be greater than the number of characters. For example:

    user@host:~$ wc -c
    Bär
    5
    user@host:~$ wc -m
    Bär
    4
    and when i do that test using a greek alpha as opposed to the a with umlaut that is used in the example, i always get 4 as a result.. not 5.. so i am not sure UTF-8 is there as
    running
    Qt Code:
    1. locale
    To copy to clipboard, switch view to plain text mode 
    in a console at my pc states:

    Qt Code:
    1. LANG=
    2. LC_CTYPE="en_US.UTF-8"
    3. LC_NUMERIC="en_US.UTF-8"
    4. LC_TIME="en_US.UTF-8"
    5. LC_COLLATE="en_US.UTF-8"
    6. LC_MONETARY="en_US.UTF-8"
    7. LC_MESSAGES="en_US.UTF-8"
    8. LC_PAPER="en_US.UTF-8"
    9. LC_NAME="en_US.UTF-8"
    10. LC_ADDRESS="en_US.UTF-8"
    11. LC_TELEPHONE="en_US.UTF-8"
    12. LC_MEASUREMENT="en_US.UTF-8"
    13. LC_IDENTIFICATION="en_US.UTF-8"
    14. LC_ALL=en_US.UTF-8
    To copy to clipboard, switch view to plain text mode 
    Last edited by nass; 31st August 2006 at 15:17.

  8. #8
    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: unable to have greek characters appear in a text Label

    Quote Originally Posted by nass
    says here UTF-8...
    OK, what encoding do you use for string literals in your sources?

  9. #9
    Join Date
    Jan 2020
    Posts
    3
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: unable to have greek characters appear in a text Label

    I had similar problem but not with Greek chars. I use "material design" font as my buttons icons. since it is a font, it is practically a set of chars. You should find each character code, they are something like 0xFFDD or 0x4C and create a QString like bellow

    QString(L'\uFFDD') for VS compiler and
    QString("\uFFDD") for mingw.

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49

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.