Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-136941

<wbr> tag support in Text/TextEdit/Label QML Type

    XMLWordPrintable

Details

    Description

      With QML Types such as Text, TextEdit and Label , when the "wrapMode" property is set to "TextEdit.WordWrap" and it holds a text longer than the object's width, it tries to display the text with wrapping it on word boundaries only.

      This works well for languages where word boundaries are easy to find, e.g. English. However, for other laguages where word boundaries are difficult to find e.g. Japanese language, the wrapping on word boundaries does not work. That seems inavoidable due to the nature of the languages.

      To provide a solution for that issue, this ticket suggests to add a support for  <wbr> tags in QML Types with limited HTML tags support, such as Text, TextEdit, Label, etc.

      Here is the description of <wbr> tag from MDN Web Docs:

      https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/wbr


      The <wbr> HTML element represents a word break opportunity—a position within text where the browser may optionally break a line, though its line-breaking rules would not otherwise create a break at that location.


      Attached application reproduces the issue with  Japanese language.

      The original english text is "This is a veryveryveryveryverylongword", and this is displayed like below.
      The line break is in between "This is a" and "veryveryveryveryverylongword" as expected :

      This is a 
      veryveryveryveryverylongword 

      The translated Japanese text is as below. The line break comes at the right edge of the window, regardless of word boundaries.

      これは1つのとてもとてもとてもとてもとても長い単語 

       

      Attachments

        1. English.png
          10 kB
          Hitoshi Ito
        2. Japanese.png
          14 kB
          Hitoshi Ito
        3. qml-i18n.zip
          8 kB
          Hitoshi Ito
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            hitoshiito Hitoshi Ito
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes