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. QTextEdit : how to force LeftToRight text direction for RightToLeft languages
Forum Updated to NodeBB v4.3 + New Features

QTextEdit : how to force LeftToRight text direction for RightToLeft languages

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.2k 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.
  • G Offline
    G Offline
    GraemeA
    wrote on last edited by
    #1

    I've tried, this:

    @
    QTextOption topt = textedit->document()->defaultTextOption();
    topt.setTextDirection(Qt::LeftToRight);
    textedit->document()->setDefaultTextOption(topt);
    @

    and this:

    @
    QTextCursor tc = textedit->textCursor();
    QTextBlockFormat tbf = tc.blockFormat();
    tbf.setLayoutDirection( Qt::LeftToRight );
    tc.setBlockFormat(tbf);
    textedit->setTextCursor(tc);
    @

    without success.

    Any ideas would be appreciated. (A QLineEdit would do just as well, but they don't seem to have as many options for controlling text direction.)

    (Why? The textedit will contain a regular expression including Arabic text. Pretty confusing to look at a regex where the text is reversed.)

    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