-
Notifications
You must be signed in to change notification settings - Fork 1
/
Process.h
43 lines (32 loc) · 956 Bytes
/
Process.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <QProcess>
#include <QObject>
#include <QVariant>
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 void kill() {
return QProcess::kill();
}
Q_INVOKABLE void terminate() {
return QProcess::terminate();
}
Q_INVOKABLE QByteArray readAll() {
return QProcess::readAll();
}
Q_INVOKABLE QByteArray readAllStandardOutput()
{
return QProcess::readAllStandardOutput();
}
Q_INVOKABLE QByteArray readAllStandardError()
{
return QProcess::readAllStandardError();
}
};