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. Standard Output Double Spaced in QTextEdit
Forum Updated to NodeBB v4.3 + New Features

Standard Output Double Spaced in QTextEdit

Scheduled Pinned Locked Moved Solved General and Desktop
qtexteditqprocessqt4
9 Posts 2 Posters 2.8k 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.
  • D Offline
    D Offline
    DougyDrumz
    wrote on last edited by
    #1

    For some reason when I:

    while (myRemoteProcess->canReadLine())
    {
        ui.outputTextEdit->append(myRemoteProcess->readLine());
    }
    

    the text is double spaced. I tried removing the "\n" from each line, counted the number of spaces and tabs to see if there weren't too many, and made sure the text was noWrap - all to no avail. The doesn't happen if append lines manually. Any ideas?

    Dougy Drumz

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What does myRemoteProcess->readLine()return ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DougyDrumz
        wrote on last edited by
        #3

        One QString with a <CR> (`\n'). It doesn't make any difference if a remove it.

        Dougy Drumz

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Are you sure you don't have \r\n in your string ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DougyDrumz
            wrote on last edited by
            #5

            Could be. Let me check.

            Dougy Drumz

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DougyDrumz
              wrote on last edited by
              #6

              Nope. Just '\n'.

              Dougy Drumz

              1 Reply Last reply
              0
              • D Offline
                D Offline
                DougyDrumz
                wrote on last edited by
                #7

                Just found out the output of readLine is QByteArray. Will investigate further.

                Dougy Drumz

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DougyDrumz
                  wrote on last edited by
                  #8

                  Ok. I found it. Here's what I did:

                  while (myRemoteProcess->canReadLine())
                  {
                      QByteArray lineArray = myRemoteProcess->readLine();
                      QString lineString(lineArray);
                      lineString.remove('\n');
                      ui.outputTextEdit->append(lineString);
                  }
                  

                  Dougy Drumz

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Good !

                    Since you have it working now please mark the thread as solved using the "Topic Tool" button so that other forum users may know a solution has been found :)

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    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