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. QProcess readLine from qDebug()
Qt 6.11 is out! See what's new in the release blog

QProcess readLine from qDebug()

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.8k Views
  • 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.
  • L Offline
    L Offline
    louis
    wrote on last edited by
    #1

    Hi,
    i started a qt-based qProcess

    i connect connect(appProcess, SIGNAL(readyReadStandardError()), this, SLOT(readStandardOutput()));

    void AppControl::readStandardOutput()
    {
    while(m_trmAppProcess->canReadLine())
    {
    qDebug() << "fromAppProcess: " << m_trmAppProcess->readLine();
    }

    but this would not work properly.
    however i can see that the signal is emitted properly so i run into the readStandardOutput function.

    canReadLine() will return false.

    how can i get those messages?

    rgards

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      readyReadStandardError() is emitted when cerr has data. you need to call setReadChannel to specify you want to read from cerr and not cout.

      void AppControl::readStandardOutput()
      {
      m_trmAppProcess->setReadChannel(QProcess::StandardError);
      while(m_trmAppProcess->canReadLine())
      {
      qDebug() << "fromAppProcess: " << m_trmAppProcess->readLine();
      }
      }

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      2
      • L Offline
        L Offline
        louis
        wrote on last edited by
        #3

        Thank You. That worked!

        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