Maintenancetool and QProcess, --checkupdates argument

  • Moderators

    Hi everyone,

    I'm using the QtInstallerframework to distribut my program and keep it up to date. I'm quite happy with it, and it works well enough for my case.

    I would now like to streamline the update, add and remove packages process for the user. I thought about downloading and parsing the xml files myself and downloading and decompressing the 7z files too, but I realised that the maintenancetool has nearly all features build in, and I could simply use QProcess and an argument string list.

    But, I'm a bit confused about how it's working, take for example this code

        QStringList args;args << "--checkupdates";
        qDebug() << "####" << endl;
        int exitCode = QProcess::execute("C:/path//to/the/maintenancetool.exe", args);
        qDebug() << endl << "exitCode" << exitCode;

    it returns, 1 when no updates are available, and 0 when there are some, easy enough.

    However looking at the Applicationoutput console, I see this:

    Where does the xml formated part come from !? oO And is there a way to catch that string for further evaluations? It would save me from parsing the generated components.xml file


  • Moderators

    Perhaps you need to merge the output channels. See the docs

  • Moderators

    @sierdzio ah, I see!

    So far my experience with QProcess is limited, so thanks for the given direction!

    I was able to adjust the "process" with QProcess 😏

    For what ever reason, I was forced to create the QProcess object on the heap and use start instead of execute.
    Or the process would still send the output to the standartoutput.

        QStringList args;args << "--checkupdates";
        qDebug() << "####" << endl;
        QProcess *process = new QProcess(this);
        qDebug() << process->processChannelMode();
        qDebug() << process->processChannelMode();
        process->start("C:/Path/To/the/maintenancetool.exe", args);
        connect(process, QOverload<int>::of(&QProcess::finished), this, [=](int exitCode){
            qDebug() << endl << "exitCode" << exitCode;
            qDebug() << process->readAll() << endl;


    I can work with that, I think :)

    thanks @sierdzio !

  • Moderators

    Thanks to you as well, for posting the solution. Maybe it will help somebody else, too :-)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.