Results 1 to 2 of 2

Thread: How to show Soft Hyphen Character in Line Edit or drawText?

  1. #1
    Join Date
    Jan 2015
    Qt products
    MacOS X Windows

    Exclamation How to show Soft Hyphen Character in Line Edit or drawText?


    I want to show a string that loaded into str1 from database. That string contained Soft Hyphen Character (00AD).
    My problem is that string (all characters except soft hyphen character) is shown in my lineEdit or painter.drawText . Only Soft Hyphen Character is disappeared.
    How can I show that string including soft hyphen?

    eg. ui->lineEdit->setText(str1);
    eg. painter.drawText(rect,Qt::AlignLeft |Qt::AlignVCenter,str1);
    Last edited by binary001; 24th September 2015 at 17:27.

  2. #2
    Join Date
    Mar 2009
    Brisbane, Australia
    Thanked 1,598 Times in 1,526 Posts
    Qt products
    Qt4 Qt5
    Unix/X11 Windows
    Wiki edits

    Default Re: How to show Soft Hyphen Character in Line Edit or drawText?

    How was that Unicode code point encoded in the database, and have you taken that into consideration?
    Does your font have a glyph for that code point?

    The soft hyphen should only be visible at the end of the line if the word containing it needs to be broken over lines during word wrapping. A line edit does not word wrap so I would never expect to see a soft hyphen there. Are you not seeing the hyphen under word wrapping or does wrapping wrap the whole word ignoring the suggested hyphenation?

    The easiest way to force visibility is to replace the soft-hyphen charcters with a hard hyphen character before rendering.

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

    binary001 (25th September 2015)

Similar Threads

  1. QTableView line edit clears the text on edit
    By PlasticJesus in forum Qt Programming
    Replies: 5
    Last Post: 14th March 2015, 20:06
  2. Replies: 3
    Last Post: 26th August 2010, 09:57
  3. Replies: 2
    Last Post: 10th November 2009, 07:17
  4. Character encoding in text edit and llne edit
    By greenvirag in forum Qt Programming
    Replies: 3
    Last Post: 20th January 2009, 09:45
  5. Replies: 8
    Last Post: 15th May 2007, 10:21


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.