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

Right to left text is left justified in QML Text

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.6.3, 5.11.2
    • Quick: Other
    • None
    • See the attached rtl.zip project to reproduce the problem.
    • Linux/X11

    Description

      The red line should be right justified. It is "text1" in the attached rtl project. The 2 blue lines are "text2" in the rtl project. The first blue line should be left justified and the second blue line should be right justified.  However when initially ran all lines are left justified. It looks like this:

      It should look like the image below.  If you click the Text1 button the red line will move and be right justified. All the button does is read the text1  implicitWidth property.

      The Text2 button reads the text2 implicitWidth property and the bottom blue line moves and is right justified.

      I see that reading the implicitWidth property causes a recalculation of layedOutTextRect in qquicktext.cpp. I believe this fixes the justification. An "if" statement (Qt 5.11.2 qquicktext.cpp line 431) seem to be key to understanding this. It is initially false which causes the wrong layedOutTextRect value. When pressing the button, the if statement is true and layedOutTextRect is correct. 

      I have not be able to understand this well enough to propose a fix.

      d

      e

      Attachments

        1. wrong.png
          wrong.png
          21 kB
        2. rtl.zip
          2 kB
        3. right.png
          right.png
          21 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              skycrestway Gary Holmlund
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes