Results 1 to 3 of 3

Thread: QLineEdit and scandinavian characacters

  1. #1
    Join Date
    Feb 2009
    Posts
    13
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QLineEdit and scandinavian characacters

    If i set the text "Åååps" or "Äärgh" in a QTextEdit field in my source file, something messy appears when the program is run. The character set is utf-8. For instance,

    formulaInput->setText(tr("Ååååh, Synöve"));

    where formulaInput is a QLineEdit field.

    What is the trick to get the same text shown in the executable as well.

    teele

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QLineEdit and scandinavian characacters

    Make sure your file is encoded in utf8 and then use QObject::trUtf8().

  3. The following user says thank you to Lykurg for this useful post:

    teele (1st August 2010)

  4. #3
    Join Date
    Feb 2009
    Posts
    13
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QLineEdit and scandinavian characacters

    Indeed,

    formulaInput->setText(trUtf8("Ååååh, Synöve"));

    solved it. Thank you, Lykurg!

Similar Threads

  1. help with QLineEdit
    By benlyboy in forum Newbie
    Replies: 2
    Last Post: 18th February 2010, 02:39
  2. QLineEdit
    By bismitapadhy in forum Qt Programming
    Replies: 3
    Last Post: 11th August 2009, 09:24
  3. QLineEdit
    By coderbob in forum Qt Programming
    Replies: 6
    Last Post: 27th February 2008, 13:27
  4. QLineEdit
    By sonuani in forum Qt Tools
    Replies: 1
    Last Post: 21st February 2008, 08:52
  5. About QLineEdit
    By vijay anandh in forum Newbie
    Replies: 2
    Last Post: 19th October 2006, 11:45

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.