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. [SOLVED] QLineEdit and QPlainTextEdit Right to left mode not working
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QLineEdit and QPlainTextEdit Right to left mode not working

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 4.7k 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.
  • S Offline
    S Offline
    SimonL
    wrote on last edited by
    #1

    Hi i am expecting that when i do
    @QApplication::setLayoutDirection(Qt::RightToLeft); @
    or
    @ QLineEdit * m_pEditBox = new QLineEdit();
    m_pEditBox->setLayoutDirection(Qt::RightToLeft)@

    in the QLineEdit or QPlainTextEdit the cursor should start at the right hand side of the edit and text should be entered toward the left. Instead it stays the same as left to right. Is this the standard behaviour of QLineEdit or is there something else that i should do?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chris H
      wrote on last edited by
      #2

      According to the documentation for setLayoutDirection, "this method no longer affects text layout direction since Qt 4.7." The new way of doing it is to just make sure you have the current language set correctly, and then Qt will know which languages to display in right-to-left mode (in theory!).

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Scylla
        wrote on last edited by
        #3

        @SimeonL
        Have you tested this? I'm interessed in because I need this function in the next project!

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SimonL
          wrote on last edited by
          #4

          We have since tested it and as Chris H has suggested it depends on the direction of the characters. It seems to go through the string that is set and when it finds the first char that is strictly right to left or left to right it sets the direction based on that.

          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