Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Solved Standard Output Double Spaced in QTextEdit

    General and Desktop
    qtextedit qprocess qt4
    2
    9
    2352
    Loading More Posts
    • 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
      DougyDrumz last edited by

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • D
          DougyDrumz last edited by

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

          Dougy Drumz

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            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 Reply Quote 0
            • D
              DougyDrumz last edited by

              Could be. Let me check.

              Dougy Drumz

              1 Reply Last reply Reply Quote 0
              • D
                DougyDrumz last edited by

                Nope. Just '\n'.

                Dougy Drumz

                1 Reply Last reply Reply Quote 0
                • D
                  DougyDrumz last edited by

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

                  Dougy Drumz

                  1 Reply Last reply Reply Quote 0
                  • D
                    DougyDrumz last edited by

                    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 Reply Quote 0
                    • SGaist
                      SGaist Lifetime Qt Champion last edited by

                      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 Reply Quote 0
                      • First post
                        Last post