QProcess Class Reference

#include <qprocess.h>

Class Description

Definition at line 102 of file qprocess.h.

+ Inheritance diagram for QProcess:

Public Types

enum  ProcessError {
  FailedToStart, Crashed, Timedout, ReadError,
  WriteError, UnknownError
}
 
enum  ProcessState { NotRunning, Starting, Running }
 
enum  ProcessChannel { StandardOutput, StandardError }
 
enum  ProcessChannelMode { SeparateChannels, MergedChannels, ForwardedChannels }
 
enum  ExitStatus { NormalExit, CrashExit }
 
- Public Types inherited from QIODevice
enum  OpenModeFlag {
  NotOpen = 0x0000, ReadOnly = 0x0001, WriteOnly = 0x0002, ReadWrite = ReadOnly | WriteOnly,
  Append = 0x0004, Truncate = 0x0008, Text = 0x0010, Unbuffered = 0x0020
}
 

Public Slots

void terminate ()
 
void kill ()
 
- Public Slots inherited from QObject
void deleteLater ()
 

Signals

void started ()
 
void finished (int exitCode)
 
void finished (int exitCode, QProcess::ExitStatus exitStatus)
 
void error (QProcess::ProcessError error)
 
void stateChanged (QProcess::ProcessState state)
 
void readyReadStandardOutput ()
 
void readyReadStandardError ()
 
- Signals inherited from QIODevice
void readyRead ()
 
void bytesWritten (qint64 bytes)
 
void aboutToClose ()
 
void readChannelFinished ()
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 

Public Member Functions

 QProcess (QObject *parent=0)
 
virtual ~QProcess ()
 
void start (const QString &program, const QStringList &arguments, OpenMode mode=ReadWrite)
 
void start (const QString &program, OpenMode mode=ReadWrite)
 
ProcessChannelMode readChannelMode () const
 
void setReadChannelMode (ProcessChannelMode mode)
 
ProcessChannelMode processChannelMode () const
 
void setProcessChannelMode (ProcessChannelMode mode)
 
ProcessChannel readChannel () const
 
void setReadChannel (ProcessChannel channel)
 
void closeReadChannel (ProcessChannel channel)
 
void closeWriteChannel ()
 
void setStandardInputFile (const QString &fileName)
 
void setStandardOutputFile (const QString &fileName, OpenMode mode=Truncate)
 
void setStandardErrorFile (const QString &fileName, OpenMode mode=Truncate)
 
void setStandardOutputProcess (QProcess *destination)
 
QString workingDirectory () const
 
void setWorkingDirectory (const QString &dir)
 
void setEnvironment (const QStringList &environment)
 
QStringList environment () const
 
void setProcessEnvironment (const QProcessEnvironment &environment)
 
QProcessEnvironment processEnvironment () const
 
QProcess::ProcessError error () const
 
QProcess::ProcessState state () const
 
Q_PID pid () const
 
bool waitForStarted (int msecs=30000)
 
bool waitForReadyRead (int msecs=30000)
 
bool waitForBytesWritten (int msecs=30000)
 
bool waitForFinished (int msecs=30000)
 
QByteArray readAllStandardOutput ()
 
QByteArray readAllStandardError ()
 
int exitCode () const
 
QProcess::ExitStatus exitStatus () const
 
qint64 bytesAvailable () const
 
qint64 bytesToWrite () const
 
bool isSequential () const
 
bool canReadLine () const
 
void close ()
 
bool atEnd () const
 
- Public Member Functions inherited from QIODevice
 QIODevice ()
 
 QIODevice (QObject *parent)
 
virtual ~QIODevice ()
 
OpenMode openMode () const
 
void setTextModeEnabled (bool enabled)
 
bool isTextModeEnabled () const
 
bool isOpen () const
 
bool isReadable () const
 
bool isWritable () const
 
virtual bool open (OpenMode mode)
 
virtual qint64 pos () const
 
virtual qint64 size () const
 
virtual bool seek (qint64 pos)
 
virtual bool reset ()
 
qint64 read (char *data, qint64 maxlen)
 
QByteArray read (qint64 maxlen)
 
QByteArray readAll ()
 
qint64 readLine (char *data, qint64 maxlen)
 
QByteArray readLine (qint64 maxlen=0)
 
qint64 write (const char *data, qint64 len)
 
qint64 write (const char *data)
 
qint64 write (const QByteArray &data)
 
qint64 peek (char *data, qint64 maxlen)
 
QByteArray peek (qint64 maxlen)
 
void ungetChar (char c)
 
bool putChar (char c)
 
bool getChar (char *c)
 
QString errorString () const
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=0)
 
virtual ~QObject ()
 
virtual bool event (QEvent *)
 
virtual bool eventFilter (QObject *, QEvent *)
 
QString objectName () const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const
 
bool signalsBlocked () const
 
bool blockSignals (bool b)
 
QThreadthread () const
 
void moveToThread (QThread *thread)
 
int startTimer (int interval)
 
void killTimer (int id)
 
template<typename T >
findChild (const QString &aName=QString()) const
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
const QObjectListchildren () const
 
void setParent (QObject *)
 
void installEventFilter (QObject *)
 
void removeEventFilter (QObject *)
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
void setUserData (uint id, QObjectUserData *data)
 
QObjectUserDatauserData (uint id) const
 
QObjectparent () const
 
bool inherits (const char *classname) const
 

Static Public Member Functions

static int execute (const QString &program, const QStringList &arguments)
 
static int execute (const QString &program)
 
static bool startDetached (const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid=0)
 
static bool startDetached (const QString &program, const QStringList &arguments)
 
static bool startDetached (const QString &program)
 
static QStringList systemEnvironment ()
 
- Static Public Member Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 

Protected Member Functions

void setProcessState (ProcessState state)
 
virtual void setupChildProcess ()
 
qint64 readData (char *data, qint64 maxlen)
 
qint64 writeData (const char *data, qint64 len)
 
- Protected Member Functions inherited from QIODevice
 QIODevice (QIODevicePrivate &dd, QObject *parent=0)
 
virtual qint64 readLineData (char *data, qint64 maxlen)
 
void setOpenMode (OpenMode openMode)
 
void setErrorString (const QString &errorString)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
virtual void timerEvent (QTimerEvent *)
 
virtual void childEvent (QChildEvent *)
 
virtual void customEvent (QEvent *)
 
virtual void connectNotify (const char *signal)
 
virtual void disconnectNotify (const char *signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 

Additional Inherited Members

- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Attributes inherited from QObject
static const QMetaObject staticQtMetaObject
 
- Properties inherited from QObject
QString objectName
 

Member Enumeration Documentation

Enumerator
FailedToStart 
Crashed 
Timedout 
ReadError 
WriteError 
UnknownError 

Definition at line 106 of file qprocess.h.

106  {
107  FailedToStart, //### file not found, resource error
108  Crashed,
109  Timedout,
110  ReadError,
111  WriteError,
113  };
Enumerator
NotRunning 
Starting 
Running 

Definition at line 114 of file qprocess.h.

Enumerator
StandardOutput 
StandardError 

Definition at line 119 of file qprocess.h.

Enumerator
SeparateChannels 
MergedChannels 
ForwardedChannels 

Definition at line 123 of file qprocess.h.

enum ExitStatus
Enumerator
NormalExit 
CrashExit 

Definition at line 128 of file qprocess.h.

128  {
129  NormalExit,
130  CrashExit
131  };

Constructor & Destructor Documentation

QProcess ( QObject parent = 0)
explicit
virtual ~QProcess ( )
virtual

Member Function Documentation

void start ( const QString program,
const QStringList arguments,
OpenMode  mode = ReadWrite 
)
void start ( const QString program,
OpenMode  mode = ReadWrite 
)
ProcessChannelMode readChannelMode ( ) const
void setReadChannelMode ( ProcessChannelMode  mode)
ProcessChannelMode processChannelMode ( ) const
void setProcessChannelMode ( ProcessChannelMode  mode)
ProcessChannel readChannel ( ) const
void setReadChannel ( ProcessChannel  channel)
void closeReadChannel ( ProcessChannel  channel)
void closeWriteChannel ( )
void setStandardInputFile ( const QString fileName)
void setStandardOutputFile ( const QString fileName,
OpenMode  mode = Truncate 
)
void setStandardErrorFile ( const QString fileName,
OpenMode  mode = Truncate 
)
void setStandardOutputProcess ( QProcess destination)
QString workingDirectory ( ) const
void setWorkingDirectory ( const QString dir)
void setEnvironment ( const QStringList environment)
QStringList environment ( ) const
void setProcessEnvironment ( const QProcessEnvironment environment)
QProcessEnvironment processEnvironment ( ) const
QProcess::ProcessError error ( ) const
QProcess::ProcessState state ( ) const
Q_PID pid ( ) const
bool waitForStarted ( int  msecs = 30000)
bool waitForReadyRead ( int  msecs = 30000)
virtual

Reimplemented from QIODevice.

bool waitForBytesWritten ( int  msecs = 30000)
virtual

Reimplemented from QIODevice.

bool waitForFinished ( int  msecs = 30000)
QByteArray readAllStandardOutput ( )
QByteArray readAllStandardError ( )
int exitCode ( ) const
QProcess::ExitStatus exitStatus ( ) const
qint64 bytesAvailable ( ) const
virtual

Reimplemented from QIODevice.

qint64 bytesToWrite ( ) const
virtual

Reimplemented from QIODevice.

bool isSequential ( ) const
virtual

Reimplemented from QIODevice.

bool canReadLine ( ) const
virtual

Reimplemented from QIODevice.

void close ( )
virtual

Reimplemented from QIODevice.

bool atEnd ( ) const
virtual

Reimplemented from QIODevice.

static int execute ( const QString program,
const QStringList arguments 
)
static
static int execute ( const QString program)
static
static bool startDetached ( const QString program,
const QStringList arguments,
const QString workingDirectory,
qint64 pid = 0 
)
static
static bool startDetached ( const QString program,
const QStringList arguments 
)
static
static bool startDetached ( const QString program)
static
static QStringList systemEnvironment ( )
static
void terminate ( )
slot
void kill ( )
slot
void started ( )
signal
void finished ( int  exitCode)
signal
void finished ( int  exitCode,
QProcess::ExitStatus  exitStatus 
)
signal
void error ( QProcess::ProcessError  error)
signal
void stateChanged ( QProcess::ProcessState  state)
signal
void readyReadStandardOutput ( )
signal
void readyReadStandardError ( )
signal
void setProcessState ( ProcessState  state)
protected
virtual void setupChildProcess ( )
protectedvirtual
qint64 readData ( char *  data,
qint64  maxlen 
)
protectedvirtual

Implements QIODevice.

qint64 writeData ( const char *  data,
qint64  len 
)
protectedvirtual

Implements QIODevice.


The documentation for this class was generated from the following file: