Qt 응용 프로그램에서 Windows .exe 실행

작업은 Qt Quick 응용 프로그램 (GUI)을 작성하여 터치 컨트롤러에 새 펌웨어를 업로드하는 것이 었습니다.
업로드 소프트웨어는 터치 컨트롤러에 .bin 파일을 로드하는 .exe 응용 프로그램에서 제조업체에서 제공했습니다.
쉘 응용 프로그램을 호출하고 제어하는 데 사용할 수있는 Qt 클래스 "QProcess"를 사용하고 싶었습니다. 리눅스 측에서는 이미 여러 번 성공적으로 사용했지만 Windows에서는 처음에는 작동하지 않았습니다.

QProcess::setWorkingDirectory

이에 대한 "트릭"또는 해결책은 "setWorkingDirectory"를 사용하는 것이 었습니다. 다음은 .h 및 .cpp 파일에서 발췌한 내용입니다. .cpp 파일의 "process->setWorkingDirectory..." 줄에 유의하십시오.
cmdlauncher.h

#ifndef CMDLAUNCHER_H
#define CMDLAUNCHER_H

#include <QObject>
#include <QtQuick>
#include <QDebug>
#include <QProcess>
#include <QVariant>
#include <QString>
#include <QDir>

class CmdLauncher : public QProcess
{
    Q_OBJECT

public:
    CmdLauncher(QObject *parent = nullptr);

    Q_INVOKABLE void start(const QString &program, const QVariantList &arguments);

    QString application_directory;
};

#endif // CMDLAUNCHER_H

cmdlauncher.cpp

#include "cmdlauncher.h"

CmdLauncher::CmdLauncher(QObject *parent) : QProcess(parent)
{
    process_running = "start";
}

void CmdLauncher::start(const QString &program, const QVariantList &arguments) {
    QStringList args;

    // convert QVariantList from QML to QStringList for QProcess/
    for (int i = 0; i < arguments.length(); i++)
        args << arguments[i].toString();

    // start request or upload process
    QProcess * process = new QProcess();
    process->setWorkingDirectory(application_directory + "/nConsoleTool");
    process->setProcessChannelMode(QProcess::MergedChannels);
    process->start(program, args);
    process->waitForFinished();

    // get values and set states
    QByteArray bytes = process->readAll();
    cmd_output = QString::fromLocal8Bit(bytes);
    emit cmdOutputChanged();
    }
}

main.qml

import QtQuick 2.9
import QtQuick.Window 2.3
import QtQuick.Controls 2.5
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.3
import CmdLauncher 1.0

ApplicationWindow {
    id: application_window
    visible: true
    width: 1024
    height: 768
    title: qsTr("Firmware Tool")

    CmdLauncher {
        id: launcher
    }

    Button {
        id: nUpdateFW
        x: 260
        y: 20
        width: 200
        height: 30
        text: "Upload Firmware"

        onClicked: {
            //console.log(launcher.application_directory + "/nConsoleTool/nUpdateFW.exe");
            if (file_path == "") {
                fileMissing.open();
            } else {
                launcher.start(launcher.application_directory + "/nConsoleTool/nUpdateFW.exe", [ file_path, "-ba" ]);
                if (launcher.controller_detected == false) {
                    controllerMissing.open();
                }
            }
        }
    }
}

</:code3:></:code2:></:code1:>