Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. qDebug() is not working anymore in QT-Creator (Installed from QT-Installer from QT.io, OS: Manjaro Linux
Qt 6.11 is out! See what's new in the release blog

qDebug() is not working anymore in QT-Creator (Installed from QT-Installer from QT.io, OS: Manjaro Linux

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
15 Posts 4 Posters 459 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.
  • H HansKottmann

    Now I have another problem, I can't get QProcess to work, it fails always with unknown error. The program I'm writing should do at the moment to call FFMPEG (ffprobe) to get the duration of the video I've selected in the gui, here the debug output. The commands for both videos are working fine when I copy them into a Linux terminal. Here the debug output:

    /home/hk/Videos/gay-thai.mp4
    /usr/bin/ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "/home/hk/Videos/gay-thai.mp4"
    Unbekannter Fehler
     Hallo 0
    /home/hk/Videos/Moderne Frauen sind überteuert liefern zu wenig und Männer haben.mp4
    /usr/bin/ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "/home/hk/Videos/Moderne Frauen sind überteuert liefern zu wenig und Männer haben.mp4"
    Unbekannter Fehler
     Hallo 0
    

    As suggested in the net, I've set the working directory in QT: QDir::setCurrent(QDir::rootPath());

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote last edited by
    #6

    @HansKottmann
    May depend on how you use QProcess and where you get the error message from.

    1 Reply Last reply
    0
    • H Offline
      H Offline
      HansKottmann
      wrote last edited by
      #7

      Here my code, I would be happy to learn from you

      Declaration of QProcess in the header file:

      QProcess *procTime = new QProcess(this)
      

      Code in the *.cpp file

      QString cmd = "/usr/bin/ffprobe";
          QStringList args;
          args << "-v error" << "-show_entries" << "format=duration" << "-of default=noprint_wrappers=1:nokey=1" << inputFileName.trimmed().prepend("\"").append("\"");
      
          connect(procTime, SIGNAL(readyRead()), this, SLOT(collectTimeData()));
          procTime->start(cmd, args);
          sendDebug(procTime->program() + " " + procTime->arguments().join(" "));
          sendDebug(procTime->errorString());
          procTime->waitForStarted();
      

      sendDebug() is the function that sends the debug messages to a QTextEdit window as I was not able to get QDebug to work.
      My platform is Manjaro Linux, QtCreator was installed with the installer from qt.io

      JonBJ jsulmJ 2 Replies Last reply
      0
      • H HansKottmann

        Here my code, I would be happy to learn from you

        Declaration of QProcess in the header file:

        QProcess *procTime = new QProcess(this)
        

        Code in the *.cpp file

        QString cmd = "/usr/bin/ffprobe";
            QStringList args;
            args << "-v error" << "-show_entries" << "format=duration" << "-of default=noprint_wrappers=1:nokey=1" << inputFileName.trimmed().prepend("\"").append("\"");
        
            connect(procTime, SIGNAL(readyRead()), this, SLOT(collectTimeData()));
            procTime->start(cmd, args);
            sendDebug(procTime->program() + " " + procTime->arguments().join(" "));
            sendDebug(procTime->errorString());
            procTime->waitForStarted();
        

        sendDebug() is the function that sends the debug messages to a QTextEdit window as I was not able to get QDebug to work.
        My platform is Manjaro Linux, QtCreator was installed with the installer from qt.io

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote last edited by JonB
        #8

        @HansKottmann said in qDebug() is not working anymore in QT-Creator (Installed from QT-Installer from QT.io, OS: Manjaro Linux:

        procTime->start(cmd, args);
        sendDebug(procTime->program() + " " + procTime->arguments().join(" "));
        sendDebug(procTime->errorString());
        procTime->waitForStarted();
        

        You are printing errorString() after start() but before even waitForStarted(). I would suggest your Unbekannter Fehler is because there is no error at this point. You have not shown any error occurs.

        I do not know about your argument quoting. Is -v error really supposed to be a single argument, it isn't if you pasted it on a command line? You are quoting the filepath? I am not sure all this quoting is correct/desired as arguments directly to ffprobe, you might need to sh -c "..." it if you are not sure. But this comes after you sort out your error tester/printing.

        1 Reply Last reply
        1
        • H HansKottmann

          Here my code, I would be happy to learn from you

          Declaration of QProcess in the header file:

          QProcess *procTime = new QProcess(this)
          

          Code in the *.cpp file

          QString cmd = "/usr/bin/ffprobe";
              QStringList args;
              args << "-v error" << "-show_entries" << "format=duration" << "-of default=noprint_wrappers=1:nokey=1" << inputFileName.trimmed().prepend("\"").append("\"");
          
              connect(procTime, SIGNAL(readyRead()), this, SLOT(collectTimeData()));
              procTime->start(cmd, args);
              sendDebug(procTime->program() + " " + procTime->arguments().join(" "));
              sendDebug(procTime->errorString());
              procTime->waitForStarted();
          

          sendDebug() is the function that sends the debug messages to a QTextEdit window as I was not able to get QDebug to work.
          My platform is Manjaro Linux, QtCreator was installed with the installer from qt.io

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote last edited by
          #9

          @HansKottmann To add to @JonB you should connect a slot to https://doc.qt.io/qt-6/qprocess.html#errorOccurred and print the error there.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • JonBJ Offline
            JonBJ Offline
            JonB
            wrote last edited by JonB
            #10

            @HansKottmann
            As @jsulm has written. And/or, both waitForStarted() and waitForFinished() return a bool, only if they return false can you then get a meaningful error()/errorString() (can do that without signal/slot).

            As I wrote before, I am dubious about your argument passing. I would expect you to use/need something more like:

            args << "-v" << "error" << "-show_entries" << "format=duration"
                 << "-of" << "default=noprint_wrappers=1:nokey=1" << inputFileName.trimmed();
            

            based on what you say works from the command line.

            1 Reply Last reply
            0
            • H Offline
              H Offline
              HansKottmann
              wrote last edited by
              #11

              I've changed the args stringlist as you proposed and I still get Unknown Error. I assume as qDebug is not working too, that QT isn't working with Manjaro. It's a mess as I relayed for year in QT, but it got obviously useless.

              1 Reply Last reply
              0
              • H Offline
                H Offline
                HansKottmann
                wrote last edited by
                #12

                I switched to openSuSE tumbleweed. QDebug works but the unknown error remains

                1 Reply Last reply
                0
                • JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote last edited by
                  #13

                  Show your updated code.

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    HansKottmann
                    wrote last edited by
                    #14

                    The only thing I've changed is the args QStringList, it looks now exactly like yours, the only difference are the quotation marks at the beginning and the end of the file path string because filenames can have white spaces:

                    args << "-v" << "error" << "-show_entries" << "format=duration" << "-of" << "default=noprint_wrappers=1:nokey=1" << inputFileName.trimmed().prepend("\"").append("\"");
                    

                    The problem with QCommand is not yet solve, I will try first very simple commands first without args, then with one, then two... I think this is the only way to debug this.

                    JonBJ 1 Reply Last reply
                    0
                    • H HansKottmann

                      The only thing I've changed is the args QStringList, it looks now exactly like yours, the only difference are the quotation marks at the beginning and the end of the file path string because filenames can have white spaces:

                      args << "-v" << "error" << "-show_entries" << "format=duration" << "-of" << "default=noprint_wrappers=1:nokey=1" << inputFileName.trimmed().prepend("\"").append("\"");
                      

                      The problem with QCommand is not yet solve, I will try first very simple commands first without args, then with one, then two... I think this is the only way to debug this.

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote last edited by JonB
                      #15

                      @HansKottmann said in qDebug() is not working anymore in QT-Creator (Installed from QT-Installer from QT.io, OS: Manjaro Linux:

                      The only thing I've changed is the args QStringList, it looks now exactly like yours, the only difference are the quotation marks at the beginning and the end of the file path string because filenames can have white spaces:

                      I already explained earlier that you are calling errorString() too early. So did @jsulm . And what to do about it. Your Unknown Error currently does not indicate anything has gone wrong. You need to change your code.

                      Your understanding of whitespace as it appears when you type a command into a shell versus how to pass arguments to spawned processes is not right. The arglist should be as a wrote and not have quotes. Or send the whole command line to bash -c.

                      1 Reply Last reply
                      1

                      • Login

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