Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Preventing reordering and realignment of LTR Text
Qt 6.11 is out! See what's new in the release blog

Preventing reordering and realignment of LTR Text

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    oncaphillis
    wrote on last edited by
    #1

    Hallo,

    When dealing with bidirectional Text (i.e. mixed LTR/RTR) Text I found the following.

    • I implement Text alignment with the code found "here":http://www.cesarbs.org/blog/2011/05/30/aligning-text-in-qgraphicstextitem/ but the QGraphicsTextItem inverts the the meaning of Left and Right Alignment when displaying e.g. a Hebrew paragraph. Is there a way to force left/right alignment independent of what the curent LTR/RTL status of the current paragraph is ?

    • Qt implements its own Bidi reordering algorithm. Since the output of our program is intended@@ to be handled by another one which uses the "fribidi":http://www.fribidi.org/ implementation I would like to disable reordering altogether and and do the logical=>visual mapping myself. Is there a way to achieve this ?

    Thank you very much....

    O.

    1 Reply Last reply
    0
    • T3STYT Offline
      T3STYT Offline
      T3STY
      wrote on last edited by
      #2

      To disable the direction switch you must set your application to do so by using "QApplication::setLayoutDirection()":http://qt-project.org/doc/qt-5.0/qtgui/qguiapplication.html#layoutDirection-prop which sets the direction.
      Basically, upon the application start, you just call setLayoutDirection() with a Qt::LeftToRight or Qt::RightToLeft parameter, and it will set the application to use this direction no matter what the user native language is.
      I'm not sure what Bidi and fribidi is but I guess it's related to the direction of objects in the application or something; by Using setLayoutDirection you're actually blocking any object and text direction switch, so I guess you're good to go with any custom ordering algorithm you want.

      1 Reply Last reply
      0
      • O Offline
        O Offline
        oncaphillis
        wrote on last edited by
        #3

        QApplication::setLayoutDirection doesn't seem to have any effect on QGraphicsTextItem elements. Perhaps because it's not a QWidget subtype

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved