Qt Components Hildon  0.20
QML components for Maemo5 with Hildon styling.
 All Classes Functions Properties Groups Pages
Public Slots | Signals | Public Member Functions | Properties | List of all members
Process Class Reference

Used to start external programs and communicate with them. More...

Public Slots

void abort ()
 Aborts a running process.
void start ()
 Starts the process.

Signals

void started ()
 This signal is emitted when the process is started.

Public Member Functions

Exitenumeration exitStatus () const
 The last exit status of the process.
string standardError ()
 The output from standard error (stderr).

Properties

string command
 The command to be executed by the process.
Processenumeration error
 The error that last occurred.
int exitCode
 The last exit code of the process.
Q_PID pid
 The unique process id.
ProcessChannelMode processChannelMode
 The channel mode of the process standard output and standard error channels.
dict processEnvironment
 The environment variables of the process.
ProcessChannel readChannel
 The read channel of the process.
string standardErrorFile
 The file to which standard error output is redirected.
string standardInputFile
 The file to which standard input is redirected.
string standardOutput
 The output from standard output (stdout).
string standardOutputFile
 The file to which standard output is redirected.
Process standardOutputProcess
 The Process to which standard output is redirected.
ProcessState state
 The current state of the process.
string workingDirectory
 The directory from which command is executed.

Detailed Description

Used to start external programs and communicate with them.

import QtQuick 1.0
import org.hildon.components 1.0
import org.hildon.utils 1.0
Window {
id: window
title: qsTr("Process Example")
visible: true
id: process
command: textField.text
}
Column {
id: column
anchors {
left: parent.left
right: parent.right
top: parent.top
}
width: parent.width
text: qsTr("Command")
}
id: textField
width: parent.width
focus: true
onAccepted: process.start()
}
Button {
id: button
width: parent.width
text: process.state == Process.Running ? qsTr("Stop") : qsTr("Start")
enabled: (textField.text != "") || (process.state == Process.Running)
onClicked: process.state == Process.Running ? process.abort() : process.start()
}
width: parent.width
text: qsTr("Result")
}
id: textArea
width: parent.width
readOnly: true
text: process.standardOutput
}
}
}
Examples:
process.qml.

Member Function Documentation

Process::Exitenumeration Process::exitStatus ( ) const

The last exit status of the process.

Possible values are:

Value Description
Process.NormalExit The process exited normally.
Process.CrashExit The process crashed.
See Also
exitCode
void Process::start ( )
slot

Starts the process.

The started() signal will be emitted if the process was started successfully.

See Also
started(), state
void Process::started ( )
signal

This signal is emitted when the process is started.

See Also
start(), state

Property Documentation

Process::Processenumeration Process::error
read

The error that last occurred.

Possible values are:

Value Description
Process.FailedToStart The process failed to start.
Process.Crashed The process crashed some time after starting successfully.
Process.WriteError An error occurred when attempting to write to the process.
Process.ReadError An error occurred when attempting to read from the process.
Process.UnknownError An unknown error occurred (default).
int Process::exitCode
read

The last exit code of the process.

See Also
exitStatus
Process::ProcessChannelMode Process::processChannelMode
readwrite

The channel mode of the process standard output and standard error channels.

Possible values are:

Value Description
Process.SeparateChannels Process manages the output of the running process, keeping standard output and standard error data in separate internal buffers (default).
Process.MergedChannels Process merges the output of the running process into the standard output channel (stdout). The standard error channel (stderr) will not receive any data.
Process.ForwardedChannels Process forwards the output of the running process onto the main process.
See Also
readChannel
Process::ProcessChannel Process::readChannel
readwrite

The read channel of the process.

Possible values are:

Value Description
Process.StandardOutput The standard output (stdout) of the running process (default).
Process.StandardError The standard error (stderr) of the running process.
string Process::standardErrorFile
readwrite

The file to which standard error output is redirected.

See Also
standardError
string Process::standardOutputFile
readwrite

The file to which standard output is redirected.

See Also
standardOutput
Process * Process::standardOutputProcess
readwrite

The Process to which standard output is redirected.

Setting this property to a valid Process is the equivalent of

$ process1 | process2

Set the property to null to reset.

See Also
standardOutput, standardOutputFile
Process::ProcessState Process::state
read

The current state of the process.

Possible values are:

Value Description
Process.NotRunning The process is not running (default).
Process.Starting The process is starting, but the program has not yet been invoked.
Process.Running The process is running and is ready for reading and writing.