?? qprocess.h
字號:
/******************************************************************************** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.**** This file is part of the QtCore module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file. Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://www.trolltech.com/products/qt/opensource.html**** If you are unsure which license is appropriate for your use, please** review the following information:** http://www.trolltech.com/products/qt/licensing.html or contact the** sales department at sales@trolltech.com.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#ifndef QPROCESS_H#define QPROCESS_H#include <QtCore/qiodevice.h>#include <QtCore/qstringlist.h>#if !defined(Q_OS_WIN32) || defined(qdoc)typedef qint64 Q_PID;#elsetypedef struct _PROCESS_INFORMATION *Q_PID;#endifQT_BEGIN_HEADERQT_MODULE(Core)#ifndef QT_NO_PROCESSclass QProcessPrivate;class Q_CORE_EXPORT QProcess : public QIODevice{ Q_OBJECTpublic: enum ProcessError { FailedToStart, //### file not found, resource error Crashed, Timedout, ReadError, WriteError, UnknownError }; enum ProcessState { NotRunning, Starting, Running }; enum ProcessChannel { StandardOutput, StandardError }; enum ProcessChannelMode { SeparateChannels, MergedChannels, ForwardedChannels }; enum ExitStatus { NormalExit, CrashExit }; explicit 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; 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; // QIODevice qint64 bytesAvailable() const; qint64 bytesToWrite() const; bool isSequential() const; bool canReadLine() const; void close(); bool atEnd() const; static int execute(const QString &program, const QStringList &arguments); static int execute(const QString &program); static bool startDetached(const QString &program, const QStringList &arguments); static bool startDetached(const QString &program); static QStringList systemEnvironment();public Q_SLOTS: void terminate(); void kill();Q_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();protected: void setProcessState(ProcessState state); virtual void setupChildProcess(); // QIODevice qint64 readData(char *data, qint64 maxlen); qint64 writeData(const char *data, qint64 len);private: Q_DECLARE_PRIVATE(QProcess) Q_DISABLE_COPY(QProcess) Q_PRIVATE_SLOT(d_func(), bool _q_canReadStandardOutput()) Q_PRIVATE_SLOT(d_func(), bool _q_canReadStandardError()) Q_PRIVATE_SLOT(d_func(), bool _q_canWrite()) Q_PRIVATE_SLOT(d_func(), bool _q_startupNotification()) Q_PRIVATE_SLOT(d_func(), bool _q_processDied()) Q_PRIVATE_SLOT(d_func(), void _q_notified()) friend class QProcessManager;};#endif // QT_NO_PROCESSQT_END_HEADER#endif // QPROCESS_H
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -