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. Checking if the content language uses the Right to left direction?
Qt 6.11 is out! See what's new in the release blog

Checking if the content language uses the Right to left direction?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 613 Views 2 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.
  • P Offline
    P Offline
    Prmego
    wrote on last edited by
    #1

    Is there a built-in method in Qt or another way to check if the content language uses the Right-to-Left direction?

    QFile fileHandle("c:/file.txt");
    if(!fileHandle.open(QFile::ReadOnly|QFile::Text))
        return;
    QTextStream fileContent(&fileHandle);
    fileContent.setCodec("UTF-8");
    fileContent.setGenerateByteOrderMark(false);
    ui->plainTextEdit->setPlainText(fileContent.readAll());
    fileHandle.close();
    
    raven-worxR 1 Reply Last reply
    0
    • P Prmego

      Is there a built-in method in Qt or another way to check if the content language uses the Right-to-Left direction?

      QFile fileHandle("c:/file.txt");
      if(!fileHandle.open(QFile::ReadOnly|QFile::Text))
          return;
      QTextStream fileContent(&fileHandle);
      fileContent.setCodec("UTF-8");
      fileContent.setGenerateByteOrderMark(false);
      ui->plainTextEdit->setPlainText(fileContent.readAll());
      fileHandle.close();
      
      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @Prmego
      if you mean just by reading a file? Then no.
      The UTF-8 encoded data in the txt file doesn't even have to be text at all. It depends if you are trying to interpret it as such.
      Are the files written by yourself? If so you could add the left-to-right information to the file and handle it appropriatly when reading it again.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      2

      • Login

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