Add example
parent
4fdf439427
commit
23abb5a393
@ -1 +1,33 @@
|
||||
Inspired by http://www.xargs.com/qml/process.html
|
||||
|
||||
Use in QML:
|
||||
|
||||
```
|
||||
Component.onCompleted: {
|
||||
process.start("some-bin", ["some args"])
|
||||
}
|
||||
|
||||
|
||||
Text {
|
||||
id: output
|
||||
x: 0
|
||||
y: 0
|
||||
text: ""
|
||||
}
|
||||
|
||||
|
||||
Process {
|
||||
id: process
|
||||
//onReadyRead: {output.text += readAll();output.text += readAllStandardOutput();}
|
||||
onReadyReadStandardError: {output.text += readAllStandardError();}
|
||||
onFinished: {
|
||||
console.log("finished", exitCode)
|
||||
output.text += exitCode.toString()
|
||||
console.log(readAllStandardError());
|
||||
}
|
||||
onErrorOccurred: {
|
||||
console.log("error!");
|
||||
output.text += readAllStandardError()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue