title: How to display Arabic notations in left-to-right direction in QLineEdit/QLabel etc.?
body: <p>In Qt's implementation <strong>arabic notation</strong> is shown in <strong>right-to-left</strong> direction, thus any strings that contain arabic notations will be right-aligned.</p>
  
  <p>But what my application wants to do is showing all texts in <strong>left-to-right</strong> direction, whether it contains arabic notations or not. And all texts are left-aligned.</p>
  
  <p>An example is shown below:</p>
  
  <ul>
  <li><p>This is <strong><em>what I want to implement</em></strong></p>
  
  <p><a href="https://i.stack.imgur.com/lfdwY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lfdwY.png" alt="what I want to implement"></a></p></li>
  <li><p>This is how <strong><code>QLineEdit</code></strong> displays texts containing arabic notations in its default way</p>
  
  <p><a href="https://i.stack.imgur.com/dUYWY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dUYWY.png" alt="arabic notation in QLineEdit"></a></p></li>
  <li><p>This is how <strong><code>QLabel</code></strong> does it</p>
  
  <p><a href="https://i.stack.imgur.com/uttNh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uttNh.png" alt="arabic notation in QLabel"></a></p></li>
  </ul>
  
  <h1>EDIT:</h1>
  
  <p>Paste the test string here. ە抠门哥ە(</p>
  
  <h1>EDIT:</h1>
  
  <p>Providing an alternate solution.</p>
  
  <p>Finally I can achieve my goal roughly by using <code>QTextEdit</code> which has a <code>QTextDocument</code>. The following code snippet shows how I did it. But I have no idea how Qt deals with text direction from a global perspective, so I can't achieve my goal with <code>QLabel</code> etc... <strong>It would be great if someone can give some detailed information about Qt's text engine.</strong></p>
  
  <pre><code>QTextDocument *doc = ui-&gt;textEdit-&gt;document();
  QTextOption textOption = doc-&gt;defaultTextOption();
  textOption.setTextDirection(Qt::LeftToRight);
  doc-&gt;setDefaultTextOption(textOption);
  ui-&gt;textEdit-&gt;setDocument(doc);
  </code></pre>