Prevent unwanted line breaks for Korean text

  • Hi.

    By default Qt would often insert line breaks into the text (e.g. when showing a dialog box with QMessageBox) at places where it was unintended by the developer. So far I have been able to fix this problem by using <nobr> ... </nobr> tags. However I noticed that certain charters, such as "-", may still cause unintended line breaks! So my solution at the moment ended up being something like this:

    @QString("<nobr>%1</nobr>").arg(tr("Some text we don't want to have line breaks!")).replace("-", "−")@

    This seams so work fine - most of the time. However one of the translators I work with has brought to my attention that it seems to fail with Korean language text! It seems for Korean text, the <nobr> is completely ignored. At least I have not been able to identify a pattern that causes the line breaks (like the "-" characters in Latin text). The unintended line breaks seem to be inserted at random places in the Korean text.

    So my question: What is the "official" way to prevent Qt from inserted unintended line breaks into Korean language text?

    Thanks in advance!

    BTW: I tried style="white-space:nowrap" too, but the result is the same as with <nobr>

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.