commit a9a895a0221f1f3eca4bbd7b4e4833a738bfa3ef Author: Kuba Orlik Date: Mon Apr 25 22:18:06 2022 +0200 Initial commit diff --git a/process.h b/process.h new file mode 100644 index 0000000..e8ee93d --- /dev/null +++ b/process.h @@ -0,0 +1,27 @@ +#include +#include + +class Process : public QProcess { + Q_OBJECT + +public: + Process(QObject *parent = 0) : QProcess(parent) { } + + Q_INVOKABLE void 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(); + + QProcess::start(program, args); + } + + Q_INVOKABLE QByteArray readAll() { + return QProcess::readAll(); + } + Q_INVOKABLE QByteArray readAllStandardError() { + return QProcess::readAllStandardError(); + } +};