You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
817 B
C

3 years ago
#include <QProcess>
#include <QVariant>
class Process : public QProcess {
Q_OBJECT
3 years ago
public:
Process(QObject *parent = 0) : QProcess(parent) {}
3 years ago
Q_INVOKABLE void start(const QString &program,
const QVariantList &arguments) {
QStringList args;
3 years ago
// convert QVariantList from QML to QStringList for QProcess
3 years ago
for (int i = 0; i < arguments.length(); i++)
args << arguments[i].toString();
3 years ago
QProcess::start(program, args);
}
3 years ago
Q_INVOKABLE QByteArray readAll() { return QProcess::readAll(); }
Q_INVOKABLE QByteArray readAllStandardError() {
return QProcess::readAllStandardError();
}
Q_INVOKABLE QByteArray readAllStandardOutput() {
return QProcess::readAllStandardOutput();
}
Q_INVOKABLE QByteArray readLine() { return QProcess::readLine(); }
3 years ago
};