PDA

View Full Version : How to show Soft Hyphen Character in Line Edit or drawText?



binary001
24th September 2015, 16:42
Hi!

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);

ChrisW67
24th September 2015, 22:16
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.