[][src]Struct qt_core::QProcess

#[repr(C)]
pub struct QProcess { /* fields omitted */ }

The QProcess class is used to start external programs and to communicate with them.

C++ class: QProcess.

C++ documentation:

The QProcess class is used to start external programs and to communicate with them.

Methods

impl QProcess[src]

pub fn slot_terminate(&self) -> Receiver<()>[src]

Attempts to terminate the process.

Returns a built-in Qt slot QProcess::terminate that can be passed to qt_core::Signal::connect.

C++ documentation:

Attempts to terminate the process.

The process may not exit as a result of calling this function (it is given the chance to prompt the user for any unsaved files, etc).

On Windows, terminate() posts a WM_CLOSE message to all top-level windows of the process and then to the main thread of the process itself. On Unix and macOS the SIGTERM signal is sent.

Console applications on Windows that do not run an event loop, or whose event loop does not handle the WM_CLOSE message, can only be terminated by calling kill().

See also kill().

pub fn slot_kill(&self) -> Receiver<()>[src]

Kills the current process, causing it to exit immediately.

Returns a built-in Qt slot QProcess::kill that can be passed to qt_core::Signal::connect.

C++ documentation:

Kills the current process, causing it to exit immediately.

On Windows, kill() uses TerminateProcess, and on Unix and macOS, the SIGKILL signal is sent to the process.

See also terminate().

pub fn started(&self) -> Signal<()>[src]

This signal is emitted by QProcess when the process has started, and state() returns Running.

Returns a built-in Qt signal QProcess::started that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted by QProcess when the process has started, and state() returns Running.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

pub fn finished(&self) -> Signal<(c_int,)>[src]

This signal is emitted when the process finishes. exitCode is the exit code of the process (only valid for normal exits), and exitStatus is the exit status. After the process has finished, the buffers in QProcess are still intact. You can still read any data that the process may have written before it finished.

Returns a built-in Qt signal QProcess::finished that can be passed to qt_core::Signal::connect.

Warning: no exact match found in C++ documentation. Below is the C++ documentation for void QProcess::finished(int exitCode, QProcess::ExitStatus exitStatus):

This signal is emitted when the process finishes. exitCode is the exit code of the process (only valid for normal exits), and exitStatus is the exit status. After the process has finished, the buffers in QProcess are still intact. You can still read any data that the process may have written before it finished.

Note: Signal finished is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(process, static_cast<void(QProcess::)(int, QProcess::ExitStatus)>(&QProcess::finished), [=](int exitCode, QProcess::ExitStatus exitStatus){ / ... */ });

See also exitStatus().

pub fn finished2(&self) -> Signal<(c_int, ExitStatus)>[src]

This signal is emitted when the process finishes. exitCode is the exit code of the process (only valid for normal exits), and exitStatus is the exit status. After the process has finished, the buffers in QProcess are still intact. You can still read any data that the process may have written before it finished.

Returns a built-in Qt signal QProcess::finished that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the process finishes. exitCode is the exit code of the process (only valid for normal exits), and exitStatus is the exit status. After the process has finished, the buffers in QProcess are still intact. You can still read any data that the process may have written before it finished.

Note: Signal finished is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(process, static_cast<void(QProcess::)(int, QProcess::ExitStatus)>(&QProcess::finished), [=](int exitCode, QProcess::ExitStatus exitStatus){ / ... */ });

See also exitStatus().

pub fn error(&self) -> Signal<(ProcessError,)>[src]

Use errorOccurred() instead.

Returns a built-in Qt signal QProcess::error that can be passed to qt_core::Signal::connect.

C++ documentation:

Use errorOccurred() instead.

Note: Signal error is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(process, static_cast<void(QProcess::)(QProcess::ProcessError)>(&QProcess::error), [=](QProcess::ProcessError error){ / ... */ });

pub fn error_occurred(&self) -> Signal<(ProcessError,)>[src]

This signal is emitted when an error occurs with the process. The specified error describes the type of error that occurred.

Returns a built-in Qt signal QProcess::errorOccurred that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when an error occurs with the process. The specified error describes the type of error that occurred.

This function was introduced in Qt 5.6.

pub fn state_changed(&self) -> Signal<(ProcessState,)>[src]

This signal is emitted whenever the state of QProcess changes. The newState argument is the state QProcess changed to.

Returns a built-in Qt signal QProcess::stateChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted whenever the state of QProcess changes. The newState argument is the state QProcess changed to.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

pub fn ready_read_standard_output(&self) -> Signal<()>[src]

This signal is emitted when the process has made new data available through its standard output channel (stdout). It is emitted regardless of the current read channel.

Returns a built-in Qt signal QProcess::readyReadStandardOutput that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the process has made new data available through its standard output channel (stdout). It is emitted regardless of the current read channel.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also readAllStandardOutput() and readChannel().

pub fn ready_read_standard_error(&self) -> Signal<()>[src]

This signal is emitted when the process has made new data available through its standard error channel (stderr). It is emitted regardless of the current read channel.

Returns a built-in Qt signal QProcess::readyReadStandardError that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the process has made new data available through its standard error channel (stderr). It is emitted regardless of the current read channel.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also readAllStandardError() and readChannel().

pub unsafe fn arguments(&self) -> CppBox<QStringList>[src]

Returns the command line arguments the process was last started with.

Calls C++ function: QStringList QProcess::arguments() const.

C++ documentation:

Returns the command line arguments the process was last started with.

This function was introduced in Qt 5.0.

See also setArguments() and start().

pub unsafe fn at_end(&self) -> bool[src]

Reimplemented from QIODevice::atEnd().

Calls C++ function: virtual bool QProcess::atEnd() const.

C++ documentation:

Reimplemented from QIODevice::atEnd().

Returns true if the process is not running, and no more data is available for reading; otherwise returns false.

pub unsafe fn bytes_available(&self) -> i64[src]

Reimplemented from QIODevice::bytesAvailable().

Calls C++ function: virtual qint64 QProcess::bytesAvailable() const.

C++ documentation:

Reimplemented from QIODevice::bytesAvailable().

pub unsafe fn bytes_to_write(&self) -> i64[src]

Reimplemented from QIODevice::bytesToWrite().

Calls C++ function: virtual qint64 QProcess::bytesToWrite() const.

C++ documentation:

Reimplemented from QIODevice::bytesToWrite().

pub unsafe fn can_read_line(&self) -> bool[src]

Reimplemented from QIODevice::canReadLine().

Calls C++ function: virtual bool QProcess::canReadLine() const.

C++ documentation:

Reimplemented from QIODevice::canReadLine().

This function operates on the current read channel.

See also readChannel() and setReadChannel().

pub unsafe fn close(&mut self)[src]

Reimplemented from QIODevice::close().

Calls C++ function: virtual void QProcess::close().

C++ documentation:

Reimplemented from QIODevice::close().

Closes all communication with the process and kills it. After calling this function, QProcess will no longer emit readyRead(), and data can no longer be read or written.

pub unsafe fn close_read_channel(&mut self, channel: ProcessChannel)[src]

Closes the read channel channel. After calling this function, QProcess will no longer receive data on the channel. Any data that has already been received is still available for reading.

Calls C++ function: void QProcess::closeReadChannel(QProcess::ProcessChannel channel).

C++ documentation:

Closes the read channel channel. After calling this function, QProcess will no longer receive data on the channel. Any data that has already been received is still available for reading.

Call this function to save memory, if you are not interested in the output of the process.

See also closeWriteChannel() and setReadChannel().

pub unsafe fn close_write_channel(&mut self)[src]

Schedules the write channel of QProcess to be closed. The channel will close once all data has been written to the process. After calling this function, any attempts to write to the process will fail.

Calls C++ function: void QProcess::closeWriteChannel().

C++ documentation:

Schedules the write channel of QProcess to be closed. The channel will close once all data has been written to the process. After calling this function, any attempts to write to the process will fail.

Closing the write channel is necessary for programs that read input data until the channel has been closed. For example, the program "more" is used to display text data in a console on both Unix and Windows. But it will not display the text data until QProcess's write channel has been closed. Example:

QProcess more; more.start("more"); more.write("Text to display"); more.closeWriteChannel(); // QProcess will emit readyRead() once "more" starts printing

The write channel is implicitly opened when start() is called.

See also closeReadChannel().

pub unsafe fn environment(&self) -> CppBox<QStringList>[src]

Returns the environment that QProcess will pass to its child process, or an empty QStringList if no environment has been set using setEnvironment(). If no environment has been set, the environment of the calling process will be used.

Calls C++ function: QStringList QProcess::environment() const.

C++ documentation:

Returns the environment that QProcess will pass to its child process, or an empty QStringList if no environment has been set using setEnvironment(). If no environment has been set, the environment of the calling process will be used.

See also processEnvironment(), setEnvironment(), and systemEnvironment().

pub unsafe fn error2(&self) -> ProcessError[src]

Use errorOccurred() instead.

Calls C++ function: QProcess::ProcessError QProcess::error() const.

Warning: no exact match found in C++ documentation. Below is the C++ documentation for void QProcess::error(QProcess::ProcessError error):

Use errorOccurred() instead.

Note: Signal error is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(process, static_cast<void(QProcess::)(QProcess::ProcessError)>(&QProcess::error), [=](QProcess::ProcessError error){ / ... */ });

pub unsafe fn execute_2a(
    program: impl CastInto<Ref<QString>>,
    arguments: impl CastInto<Ref<QStringList>>
) -> c_int
[src]

Starts the program program with the arguments arguments in a new process, waits for it to finish, and then returns the exit code of the process. Any data the new process writes to the console is forwarded to the calling process.

Calls C++ function: static int QProcess::execute(const QString& program, const QStringList& arguments).

C++ documentation:

Starts the program program with the arguments arguments in a new process, waits for it to finish, and then returns the exit code of the process. Any data the new process writes to the console is forwarded to the calling process.

The environment and working directory are inherited from the calling process.

Argument handling is identical to the respective start() overload.

If the process cannot be started, -2 is returned. If the process crashes, -1 is returned. Otherwise, the process' exit code is returned.

See also start().

pub unsafe fn execute_1a(command: impl CastInto<Ref<QString>>) -> c_int[src]

This is an overloaded function.

Calls C++ function: static int QProcess::execute(const QString& command).

C++ documentation:

This is an overloaded function.

Starts the program command in a new process, waits for it to finish, and then returns the exit code.

Argument handling is identical to the respective start() overload.

After the command string has been split and unquoted, this function behaves like the overload which takes the arguments as a string list.

See also start().

pub unsafe fn exit_code(&self) -> c_int[src]

Returns the exit code of the last process that finished.

Calls C++ function: int QProcess::exitCode() const.

C++ documentation:

Returns the exit code of the last process that finished.

This value is not valid unless exitStatus() returns NormalExit.

pub unsafe fn exit_status(&self) -> ExitStatus[src]

Returns the exit status of the last process that finished.

Calls C++ function: QProcess::ExitStatus QProcess::exitStatus() const.

C++ documentation:

Returns the exit status of the last process that finished.

On Windows, if the process was terminated with TerminateProcess() from another application, this function will still return NormalExit unless the exit code is less than 0.

This function was introduced in Qt 4.1.

pub unsafe fn input_channel_mode(&self) -> InputChannelMode[src]

Returns the channel mode of the QProcess standard input channel.

Calls C++ function: QProcess::InputChannelMode QProcess::inputChannelMode() const.

C++ documentation:

Returns the channel mode of the QProcess standard input channel.

This function was introduced in Qt 5.2.

See also setInputChannelMode() and InputChannelMode.

pub unsafe fn is_sequential(&self) -> bool[src]

Reimplemented from QIODevice::isSequential().

Calls C++ function: virtual bool QProcess::isSequential() const.

C++ documentation:

Reimplemented from QIODevice::isSequential().

pub unsafe fn kill(&mut self)[src]

Kills the current process, causing it to exit immediately.

Calls C++ function: [slot] void QProcess::kill().

C++ documentation:

Kills the current process, causing it to exit immediately.

On Windows, kill() uses TerminateProcess, and on Unix and macOS, the SIGKILL signal is sent to the process.

See also terminate().

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QProcess::metaObject() const.

pub unsafe fn new_1a(parent: impl CastInto<MutPtr<QObject>>) -> QBox<QProcess>[src]

Constructs a QProcess object with the given parent.

Calls C++ function: [constructor] void QProcess::QProcess(QObject* parent = …).

C++ documentation:

Constructs a QProcess object with the given parent.

pub unsafe fn new_0a() -> QBox<QProcess>[src]

The QProcess class is used to start external programs and to communicate with them.

Calls C++ function: [constructor] void QProcess::QProcess().

C++ documentation:

The QProcess class is used to start external programs and to communicate with them.

pub unsafe fn null_device() -> CppBox<QString>[src]

The null device of the operating system.

Calls C++ function: static QString QProcess::nullDevice().

C++ documentation:

The null device of the operating system.

The returned file path uses native directory separators.

This function was introduced in Qt 5.2.

See also QProcess::setStandardInputFile(), QProcess::setStandardOutputFile(), and QProcess::setStandardErrorFile().

pub unsafe fn open_1a(&mut self, mode: QFlags<OpenModeFlag>) -> bool[src]

Reimplemented from QIODevice::open().

Calls C++ function: virtual bool QProcess::open(QFlags<QIODevice::OpenModeFlag> mode = …).

C++ documentation:

Reimplemented from QIODevice::open().

Starts the program set by setProgram() with arguments set by setArguments(). The OpenMode is set to mode.

This method is an alias for start(), and exists only to fully implement the interface defined by QIODevice.

See also start(), setProgram(), and setArguments().

pub unsafe fn open_0a(&mut self) -> bool[src]

Reimplemented from QIODevice::open().

Calls C++ function: virtual bool QProcess::open().

C++ documentation:

Reimplemented from QIODevice::open().

Starts the program set by setProgram() with arguments set by setArguments(). The OpenMode is set to mode.

This method is an alias for start(), and exists only to fully implement the interface defined by QIODevice.

See also start(), setProgram(), and setArguments().

pub unsafe fn process_channel_mode(&self) -> ProcessChannelMode[src]

Returns the channel mode of the QProcess standard output and standard error channels.

Calls C++ function: QProcess::ProcessChannelMode QProcess::processChannelMode() const.

C++ documentation:

Returns the channel mode of the QProcess standard output and standard error channels.

This function was introduced in Qt 4.2.

See also setProcessChannelMode(), ProcessChannelMode, and setReadChannel().

pub unsafe fn process_environment(&self) -> CppBox<QProcessEnvironment>[src]

Returns the environment that QProcess will pass to its child process, or an empty object if no environment has been set using setEnvironment() or setProcessEnvironment(). If no environment has been set, the environment of the calling process will be used.

Calls C++ function: QProcessEnvironment QProcess::processEnvironment() const.

C++ documentation:

Returns the environment that QProcess will pass to its child process, or an empty object if no environment has been set using setEnvironment() or setProcessEnvironment(). If no environment has been set, the environment of the calling process will be used.

This function was introduced in Qt 4.6.

See also setProcessEnvironment(), setEnvironment(), and QProcessEnvironment::isEmpty().

pub unsafe fn process_id(&self) -> i64[src]

Returns the native process identifier for the running process, if available. If no process is currently running, 0 is returned.

Calls C++ function: qint64 QProcess::processId() const.

C++ documentation:

Returns the native process identifier for the running process, if available. If no process is currently running, 0 is returned.

This function was introduced in Qt 5.3.

pub unsafe fn program(&self) -> CppBox<QString>[src]

Returns the program the process was last started with.

Calls C++ function: QString QProcess::program() const.

C++ documentation:

Returns the program the process was last started with.

This function was introduced in Qt 5.0.

See also setProgram() and start().

pub unsafe fn qt_metacall(
    &mut self,
    arg1: Call,
    arg2: c_int,
    arg3: impl CastInto<MutPtr<*mut c_void>>
) -> c_int
[src]

Calls C++ function: virtual int QProcess::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(
    &mut self,
    arg1: impl CastInto<Ptr<c_char>>
) -> MutPtr<c_void>
[src]

Calls C++ function: virtual void* QProcess::qt_metacast(const char* arg1).

pub unsafe fn read_all_standard_error(&mut self) -> CppBox<QByteArray>[src]

Regardless of the current read channel, this function returns all data available from the standard error of the process as a QByteArray.

Calls C++ function: QByteArray QProcess::readAllStandardError().

C++ documentation:

Regardless of the current read channel, this function returns all data available from the standard error of the process as a QByteArray.

See also readyReadStandardError(), readAllStandardOutput(), readChannel(), and setReadChannel().

pub unsafe fn read_all_standard_output(&mut self) -> CppBox<QByteArray>[src]

Regardless of the current read channel, this function returns all data available from the standard output of the process as a QByteArray.

Calls C++ function: QByteArray QProcess::readAllStandardOutput().

C++ documentation:

Regardless of the current read channel, this function returns all data available from the standard output of the process as a QByteArray.

See also readyReadStandardOutput(), readAllStandardError(), readChannel(), and setReadChannel().

pub unsafe fn read_channel(&self) -> ProcessChannel[src]

Returns the current read channel of the QProcess.

Calls C++ function: QProcess::ProcessChannel QProcess::readChannel() const.

C++ documentation:

Returns the current read channel of the QProcess.

See also setReadChannel().

pub unsafe fn read_channel_mode(&self) -> ProcessChannelMode[src]

Returns the read channel mode of the QProcess. This function is equivalent to processChannelMode()

Calls C++ function: QProcess::ProcessChannelMode QProcess::readChannelMode() const.

C++ documentation:

Returns the read channel mode of the QProcess. This function is equivalent to processChannelMode()

See also setReadChannelMode() and processChannelMode().

pub unsafe fn set_arguments(
    &mut self,
    arguments: impl CastInto<Ref<QStringList>>
)
[src]

Set the arguments to pass to the called program when starting the process. This function must be called before start().

Calls C++ function: void QProcess::setArguments(const QStringList& arguments).

C++ documentation:

Set the arguments to pass to the called program when starting the process. This function must be called before start().

This function was introduced in Qt 5.1.

See also start(), setProgram(), and arguments().

pub unsafe fn set_environment(
    &mut self,
    environment: impl CastInto<Ref<QStringList>>
)
[src]

Sets the environment that QProcess will pass to the child process. The parameter environment is a list of key=value pairs.

Calls C++ function: void QProcess::setEnvironment(const QStringList& environment).

C++ documentation:

Sets the environment that QProcess will pass to the child process. The parameter environment is a list of key=value pairs.

For example, the following code adds the environment variable TMPDIR:

QProcess process; QStringList env = QProcess::systemEnvironment(); env << "TMPDIR=C:\MyApp\temp"; // Add an environment variable process.setEnvironment(env); process.start("myapp");

Note: This function is less efficient than the setProcessEnvironment() function.

See also environment(), setProcessEnvironment(), and systemEnvironment().

pub unsafe fn set_input_channel_mode(&mut self, mode: InputChannelMode)[src]

Sets the channel mode of the QProcess standard input channel to the mode specified. This mode will be used the next time start() is called.

Calls C++ function: void QProcess::setInputChannelMode(QProcess::InputChannelMode mode).

C++ documentation:

Sets the channel mode of the QProcess standard input channel to the mode specified. This mode will be used the next time start() is called.

This function was introduced in Qt 5.2.

See also inputChannelMode() and InputChannelMode.

pub unsafe fn set_process_channel_mode(&mut self, mode: ProcessChannelMode)[src]

Sets the channel mode of the QProcess standard output and standard error channels to the mode specified. This mode will be used the next time start() is called. For example:

Calls C++ function: void QProcess::setProcessChannelMode(QProcess::ProcessChannelMode mode).

C++ documentation:

Sets the channel mode of the QProcess standard output and standard error channels to the mode specified. This mode will be used the next time start() is called. For example:


  QProcess builder;
  builder.setProcessChannelMode(QProcess::MergedChannels);
  builder.start("make", QStringList() << "-j2");

  if (!builder.waitForFinished())
      qDebug() << "Make failed:" << builder.errorString();
  else
      qDebug() << "Make output:" << builder.readAll();

This function was introduced in Qt 4.2.

See also processChannelMode(), ProcessChannelMode, and setReadChannel().

pub unsafe fn set_process_environment(
    &mut self,
    environment: impl CastInto<Ref<QProcessEnvironment>>
)
[src]

Sets the environment that QProcess will pass to the child process.

Calls C++ function: void QProcess::setProcessEnvironment(const QProcessEnvironment& environment).

C++ documentation:

Sets the environment that QProcess will pass to the child process.

For example, the following code adds the environment variable TMPDIR:

QProcess process; QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert("TMPDIR", "C:\MyApp\temp"); // Add an environment variable process.setProcessEnvironment(env); process.start("myapp");

Note how, on Windows, environment variable names are case-insensitive.

This function was introduced in Qt 4.6.

See also processEnvironment(), QProcessEnvironment::systemEnvironment(), and setEnvironment().

pub unsafe fn set_program(&mut self, program: impl CastInto<Ref<QString>>)[src]

Set the program to use when starting the process. This function must be called before start().

Calls C++ function: void QProcess::setProgram(const QString& program).

C++ documentation:

Set the program to use when starting the process. This function must be called before start().

This function was introduced in Qt 5.1.

See also start(), setArguments(), and program().

pub unsafe fn set_read_channel(&mut self, channel: ProcessChannel)[src]

Sets the current read channel of the QProcess to the given channel. The current input channel is used by the functions read(), readAll(), readLine(), and getChar(). It also determines which channel triggers QProcess to emit readyRead().

Calls C++ function: void QProcess::setReadChannel(QProcess::ProcessChannel channel).

C++ documentation:

Sets the current read channel of the QProcess to the given channel. The current input channel is used by the functions read(), readAll(), readLine(), and getChar(). It also determines which channel triggers QProcess to emit readyRead().

See also readChannel().

pub unsafe fn set_read_channel_mode(&mut self, mode: ProcessChannelMode)[src]

Use setProcessChannelMode(mode) instead.

Calls C++ function: void QProcess::setReadChannelMode(QProcess::ProcessChannelMode mode).

C++ documentation:

Use setProcessChannelMode(mode) instead.

See also readChannelMode() and setProcessChannelMode().

pub unsafe fn set_standard_error_file_2a(
    &mut self,
    file_name: impl CastInto<Ref<QString>>,
    mode: QFlags<OpenModeFlag>
)
[src]

Redirects the process' standard error to the file fileName. When the redirection is in place, the standard error read channel is closed: reading from it using read() will always fail, as will readAllStandardError(). The file will be appended to if mode is Append, otherwise, it will be truncated.

Calls C++ function: void QProcess::setStandardErrorFile(const QString& fileName, QFlags<QIODevice::OpenModeFlag> mode = …).

C++ documentation:

Redirects the process' standard error to the file fileName. When the redirection is in place, the standard error read channel is closed: reading from it using read() will always fail, as will readAllStandardError(). The file will be appended to if mode is Append, otherwise, it will be truncated.

See setStandardOutputFile() for more information on how the file is opened.

Note: if setProcessChannelMode() was called with an argument of QProcess::MergedChannels, this function has no effect.

This function was introduced in Qt 4.2.

See also setStandardInputFile(), setStandardOutputFile(), and setStandardOutputProcess().

pub unsafe fn set_standard_error_file_1a(
    &mut self,
    file_name: impl CastInto<Ref<QString>>
)
[src]

Redirects the process' standard error to the file fileName. When the redirection is in place, the standard error read channel is closed: reading from it using read() will always fail, as will readAllStandardError(). The file will be appended to if mode is Append, otherwise, it will be truncated.

Calls C++ function: void QProcess::setStandardErrorFile(const QString& fileName).

C++ documentation:

Redirects the process' standard error to the file fileName. When the redirection is in place, the standard error read channel is closed: reading from it using read() will always fail, as will readAllStandardError(). The file will be appended to if mode is Append, otherwise, it will be truncated.

See setStandardOutputFile() for more information on how the file is opened.

Note: if setProcessChannelMode() was called with an argument of QProcess::MergedChannels, this function has no effect.

This function was introduced in Qt 4.2.

See also setStandardInputFile(), setStandardOutputFile(), and setStandardOutputProcess().

pub unsafe fn set_standard_input_file(
    &mut self,
    file_name: impl CastInto<Ref<QString>>
)
[src]

Redirects the process' standard input to the file indicated by fileName. When an input redirection is in place, the QProcess object will be in read-only mode (calling write() will result in error).

Calls C++ function: void QProcess::setStandardInputFile(const QString& fileName).

C++ documentation:

Redirects the process' standard input to the file indicated by fileName. When an input redirection is in place, the QProcess object will be in read-only mode (calling write() will result in error).

To make the process read EOF right away, pass nullDevice() here. This is cleaner than using closeWriteChannel() before writing any data, because it can be set up prior to starting the process.

If the file fileName does not exist at the moment start() is called or is not readable, starting the process will fail.

Calling setStandardInputFile() after the process has started has no effect.

This function was introduced in Qt 4.2.

See also setStandardOutputFile(), setStandardErrorFile(), and setStandardOutputProcess().

pub unsafe fn set_standard_output_file_2a(
    &mut self,
    file_name: impl CastInto<Ref<QString>>,
    mode: QFlags<OpenModeFlag>
)
[src]

Redirects the process' standard output to the file fileName. When the redirection is in place, the standard output read channel is closed: reading from it using read() will always fail, as will readAllStandardOutput().

Calls C++ function: void QProcess::setStandardOutputFile(const QString& fileName, QFlags<QIODevice::OpenModeFlag> mode = …).

C++ documentation:

Redirects the process' standard output to the file fileName. When the redirection is in place, the standard output read channel is closed: reading from it using read() will always fail, as will readAllStandardOutput().

To discard all standard output from the process, pass nullDevice() here. This is more efficient than simply never reading the standard output, as no QProcess buffers are filled.

If the file fileName doesn't exist at the moment start() is called, it will be created. If it cannot be created, the starting will fail.

If the file exists and mode is QIODevice::Truncate, the file will be truncated. Otherwise (if mode is QIODevice::Append), the file will be appended to.

Calling setStandardOutputFile() after the process has started has no effect.

This function was introduced in Qt 4.2.

See also setStandardInputFile(), setStandardErrorFile(), and setStandardOutputProcess().

pub unsafe fn set_standard_output_file_1a(
    &mut self,
    file_name: impl CastInto<Ref<QString>>
)
[src]

Redirects the process' standard output to the file fileName. When the redirection is in place, the standard output read channel is closed: reading from it using read() will always fail, as will readAllStandardOutput().

Calls C++ function: void QProcess::setStandardOutputFile(const QString& fileName).

C++ documentation:

Redirects the process' standard output to the file fileName. When the redirection is in place, the standard output read channel is closed: reading from it using read() will always fail, as will readAllStandardOutput().

To discard all standard output from the process, pass nullDevice() here. This is more efficient than simply never reading the standard output, as no QProcess buffers are filled.

If the file fileName doesn't exist at the moment start() is called, it will be created. If it cannot be created, the starting will fail.

If the file exists and mode is QIODevice::Truncate, the file will be truncated. Otherwise (if mode is QIODevice::Append), the file will be appended to.

Calling setStandardOutputFile() after the process has started has no effect.

This function was introduced in Qt 4.2.

See also setStandardInputFile(), setStandardErrorFile(), and setStandardOutputProcess().

pub unsafe fn set_standard_output_process(
    &mut self,
    destination: impl CastInto<MutPtr<QProcess>>
)
[src]

Pipes the standard output stream of this process to the destination process' standard input.

Calls C++ function: void QProcess::setStandardOutputProcess(QProcess* destination).

C++ documentation:

Pipes the standard output stream of this process to the destination process' standard input.

The following shell command:

command1 | command2

Can be accomplished with QProcess with the following code:

QProcess process1; QProcess process2;

process1.setStandardOutputProcess(&process2);

process1.start("command1"); process2.start("command2");

This function was introduced in Qt 4.2.

pub unsafe fn set_working_directory(&mut self, dir: impl CastInto<Ref<QString>>)[src]

Sets the working directory to dir. QProcess will start the process in this directory. The default behavior is to start the process in the working directory of the calling process.

Calls C++ function: void QProcess::setWorkingDirectory(const QString& dir).

C++ documentation:

Sets the working directory to dir. QProcess will start the process in this directory. The default behavior is to start the process in the working directory of the calling process.

Note: On QNX, this may cause all application threads to temporarily freeze.

See also workingDirectory() and start().

pub unsafe fn start_q_string_q_string_list_q_flags_open_mode_flag(
    &mut self,
    program: impl CastInto<Ref<QString>>,
    arguments: impl CastInto<Ref<QStringList>>,
    mode: QFlags<OpenModeFlag>
)
[src]

Starts the given program in a new process, passing the command line arguments in arguments.

Calls C++ function: void QProcess::start(const QString& program, const QStringList& arguments, QFlags<QIODevice::OpenModeFlag> mode = …).

C++ documentation:

Starts the given program in a new process, passing the command line arguments in arguments.

The QProcess object will immediately enter the Starting state. If the process starts successfully, QProcess will emit started(); otherwise, errorOccurred() will be emitted.

Note: Processes are started asynchronously, which means the started() and errorOccurred() signals may be delayed. Call waitForStarted() to make sure the process has started (or has failed to start) and those signals have been emitted.

Note: No further splitting of the arguments is performed.

Windows: The arguments are quoted and joined into a command line that is compatible with the CommandLineToArgvW() Windows function. For programs that have different command line quoting requirements, you need to use setNativeArguments(). One notable program that does not follow the CommandLineToArgvW() rules is cmd.exe and, by consequence, all batch scripts.

The OpenMode is set to mode.

If the QProcess object is already running a process, a warning may be printed at the console, and the existing process will continue running unaffected.

See also processId(), started(), waitForStarted(), and setNativeArguments().

pub unsafe fn start_q_string_q_flags_open_mode_flag(
    &mut self,
    command: impl CastInto<Ref<QString>>,
    mode: QFlags<OpenModeFlag>
)
[src]

This is an overloaded function.

Calls C++ function: void QProcess::start(const QString& command, QFlags<QIODevice::OpenModeFlag> mode = …).

C++ documentation:

This is an overloaded function.

Starts the command command in a new process. The OpenMode is set to mode.

command is a single string of text containing both the program name and its arguments. The arguments are separated by one or more spaces. For example:

QProcess process; process.start("del /s .txt"); // same as process.start("del", QStringList() << "/s" << ".txt"); ...

Arguments containing spaces must be quoted to be correctly supplied to the new process. For example:

QProcess process; process.start("dir "My Documents"");

Literal quotes in the command string are represented by triple quotes. For example:

QProcess process; process.start("dir "Epic 12""" Singles"");

After the command string has been split and unquoted, this function behaves like the overload which takes the arguments as a string list.

You can disable this overload by defining QT_NO_PROCESS_COMBINED_ARGUMENT_START when you compile your applications. This can be useful if you want to ensure that you are not splitting arguments unintentionally, for example. In virtually all cases, using the other overload is the preferred method.

On operating systems where the system API for passing command line arguments to a subprocess natively uses a single string (Windows), one can conceive command lines which cannot be passed via QProcess's portable list-based API. In these rare cases you need to use setProgram() and setNativeArguments() instead of this function.

pub unsafe fn start_q_flags_open_mode_flag(
    &mut self,
    mode: QFlags<OpenModeFlag>
)
[src]

This is an overloaded function.

Calls C++ function: void QProcess::start(QFlags<QIODevice::OpenModeFlag> mode = …).

C++ documentation:

This is an overloaded function.

Starts the program set by setProgram() with arguments set by setArguments(). The OpenMode is set to mode.

This function was introduced in Qt 5.1.

See also open(), setProgram(), and setArguments().

pub unsafe fn start_q_string_q_string_list(
    &mut self,
    program: impl CastInto<Ref<QString>>,
    arguments: impl CastInto<Ref<QStringList>>
)
[src]

Starts the given program in a new process, passing the command line arguments in arguments.

Calls C++ function: void QProcess::start(const QString& program, const QStringList& arguments).

C++ documentation:

Starts the given program in a new process, passing the command line arguments in arguments.

The QProcess object will immediately enter the Starting state. If the process starts successfully, QProcess will emit started(); otherwise, errorOccurred() will be emitted.

Note: Processes are started asynchronously, which means the started() and errorOccurred() signals may be delayed. Call waitForStarted() to make sure the process has started (or has failed to start) and those signals have been emitted.

Note: No further splitting of the arguments is performed.

Windows: The arguments are quoted and joined into a command line that is compatible with the CommandLineToArgvW() Windows function. For programs that have different command line quoting requirements, you need to use setNativeArguments(). One notable program that does not follow the CommandLineToArgvW() rules is cmd.exe and, by consequence, all batch scripts.

The OpenMode is set to mode.

If the QProcess object is already running a process, a warning may be printed at the console, and the existing process will continue running unaffected.

See also processId(), started(), waitForStarted(), and setNativeArguments().

pub unsafe fn start_q_string(&mut self, command: impl CastInto<Ref<QString>>)[src]

This is an overloaded function.

Calls C++ function: void QProcess::start(const QString& command).

C++ documentation:

This is an overloaded function.

Starts the command command in a new process. The OpenMode is set to mode.

command is a single string of text containing both the program name and its arguments. The arguments are separated by one or more spaces. For example:

QProcess process; process.start("del /s .txt"); // same as process.start("del", QStringList() << "/s" << ".txt"); ...

Arguments containing spaces must be quoted to be correctly supplied to the new process. For example:

QProcess process; process.start("dir "My Documents"");

Literal quotes in the command string are represented by triple quotes. For example:

QProcess process; process.start("dir "Epic 12""" Singles"");

After the command string has been split and unquoted, this function behaves like the overload which takes the arguments as a string list.

You can disable this overload by defining QT_NO_PROCESS_COMBINED_ARGUMENT_START when you compile your applications. This can be useful if you want to ensure that you are not splitting arguments unintentionally, for example. In virtually all cases, using the other overload is the preferred method.

On operating systems where the system API for passing command line arguments to a subprocess natively uses a single string (Windows), one can conceive command lines which cannot be passed via QProcess's portable list-based API. In these rare cases you need to use setProgram() and setNativeArguments() instead of this function.

pub unsafe fn start(&mut self)[src]

This is an overloaded function.

Calls C++ function: void QProcess::start().

C++ documentation:

This is an overloaded function.

Starts the program set by setProgram() with arguments set by setArguments(). The OpenMode is set to mode.

This function was introduced in Qt 5.1.

See also open(), setProgram(), and setArguments().

pub unsafe fn start_detached_4a(
    program: impl CastInto<Ref<QString>>,
    arguments: impl CastInto<Ref<QStringList>>,
    working_directory: impl CastInto<Ref<QString>>,
    pid: impl CastInto<MutPtr<i64>>
) -> bool
[src]

Starts the program program with the arguments arguments in a new process, and detaches from it. Returns true on success; otherwise returns false. If the calling process exits, the detached process will continue to run unaffected.

Calls C++ function: static bool QProcess::startDetached(const QString& program, const QStringList& arguments, const QString& workingDirectory, qint64* pid = …).

C++ documentation:

Starts the program program with the arguments arguments in a new process, and detaches from it. Returns true on success; otherwise returns false. If the calling process exits, the detached process will continue to run unaffected.

Argument handling is identical to the respective start() overload.

Unix: The started process will run in its own session and act like a daemon.

The process will be started in the directory workingDirectory. If workingDirectory is empty, the working directory is inherited from the calling process.

Note: On QNX, this may cause all application threads to temporarily freeze.

If the function is successful then *pid is set to the process identifier of the started process.

See also start().

pub unsafe fn start_detached_2a(
    program: impl CastInto<Ref<QString>>,
    arguments: impl CastInto<Ref<QStringList>>
) -> bool
[src]

Calls C++ function: static bool QProcess::startDetached(const QString& program, const QStringList& arguments).

pub unsafe fn start_detached_1a(command: impl CastInto<Ref<QString>>) -> bool[src]

This is an overloaded function.

Calls C++ function: static bool QProcess::startDetached(const QString& command).

C++ documentation:

This is an overloaded function.

Starts the command command in a new process, and detaches from it. Returns true on success; otherwise returns false.

Argument handling is identical to the respective start() overload.

After the command string has been split and unquoted, this function behaves like the overload which takes the arguments as a string list.

See also start(const QString &command, OpenMode mode).

pub unsafe fn start_detached_3a(
    program: impl CastInto<Ref<QString>>,
    arguments: impl CastInto<Ref<QStringList>>,
    working_directory: impl CastInto<Ref<QString>>
) -> bool
[src]

Starts the program program with the arguments arguments in a new process, and detaches from it. Returns true on success; otherwise returns false. If the calling process exits, the detached process will continue to run unaffected.

Calls C++ function: static bool QProcess::startDetached(const QString& program, const QStringList& arguments, const QString& workingDirectory).

C++ documentation:

Starts the program program with the arguments arguments in a new process, and detaches from it. Returns true on success; otherwise returns false. If the calling process exits, the detached process will continue to run unaffected.

Argument handling is identical to the respective start() overload.

Unix: The started process will run in its own session and act like a daemon.

The process will be started in the directory workingDirectory. If workingDirectory is empty, the working directory is inherited from the calling process.

Note: On QNX, this may cause all application threads to temporarily freeze.

If the function is successful then *pid is set to the process identifier of the started process.

See also start().

pub unsafe fn start_detached_1a_mut(
    &mut self,
    pid: impl CastInto<MutPtr<i64>>
) -> bool
[src]

Starts the program set by setProgram() with arguments set by setArguments() in a new process, and detaches from it. Returns true on success; otherwise returns false. If the calling process exits, the detached process will continue to run unaffected.

Calls C++ function: bool QProcess::startDetached(qint64* pid = …).

C++ documentation:

Starts the program set by setProgram() with arguments set by setArguments() in a new process, and detaches from it. Returns true on success; otherwise returns false. If the calling process exits, the detached process will continue to run unaffected.

Unix: The started process will run in its own session and act like a daemon.

The process will be started in the directory set by setWorkingDirectory(). If workingDirectory() is empty, the working directory is inherited from the calling process.

Note: On QNX, this may cause all application threads to temporarily freeze.

If the function is successful then *pid is set to the process identifier of the started process. Note that the child process may exit and the PID may become invalid without notice. Furthermore, after the child process exits, the same PID may be recycled and used by a completely different process. User code should be careful when using this variable, especially if one intends to forcibly terminate the process by operating system means.

Only the following property setters are supported by startDetached():

All other properties of the QProcess object are ignored.

Note: The called process inherits the console window of the calling process. To suppress console output, redirect standard/error output to QProcess::nullDevice().

This function was introduced in Qt 5.10.

See also start(), startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid), and startDetached(const QString &command).

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

pub unsafe fn start_detached_0a_mut(&mut self) -> bool[src]

Starts the program set by setProgram() with arguments set by setArguments() in a new process, and detaches from it. Returns true on success; otherwise returns false. If the calling process exits, the detached process will continue to run unaffected.

Calls C++ function: bool QProcess::startDetached().

C++ documentation:

Starts the program set by setProgram() with arguments set by setArguments() in a new process, and detaches from it. Returns true on success; otherwise returns false. If the calling process exits, the detached process will continue to run unaffected.

Unix: The started process will run in its own session and act like a daemon.

The process will be started in the directory set by setWorkingDirectory(). If workingDirectory() is empty, the working directory is inherited from the calling process.

Note: On QNX, this may cause all application threads to temporarily freeze.

If the function is successful then *pid is set to the process identifier of the started process. Note that the child process may exit and the PID may become invalid without notice. Furthermore, after the child process exits, the same PID may be recycled and used by a completely different process. User code should be careful when using this variable, especially if one intends to forcibly terminate the process by operating system means.

Only the following property setters are supported by startDetached():

All other properties of the QProcess object are ignored.

Note: The called process inherits the console window of the calling process. To suppress console output, redirect standard/error output to QProcess::nullDevice().

This function was introduced in Qt 5.10.

See also start(), startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid), and startDetached(const QString &command).

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

pub unsafe fn state(&self) -> ProcessState[src]

Returns the current state of the process.

Calls C++ function: QProcess::ProcessState QProcess::state() const.

C++ documentation:

Returns the current state of the process.

See also stateChanged() and error().

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn system_environment() -> CppBox<QStringList>[src]

Returns the environment of the calling process as a list of key=value pairs. Example:

Calls C++ function: static QStringList QProcess::systemEnvironment().

C++ documentation:

Returns the environment of the calling process as a list of key=value pairs. Example:


  QStringList environment = QProcess::systemEnvironment();
  // environment = {"PATH=/usr/bin:/usr/local/bin",
  //                "USER=greg", "HOME=/home/greg"}

This function does not cache the system environment. Therefore, it's possible to obtain an updated version of the environment if low-level C library functions like setenv or putenv have been called.

However, note that repeated calls to this function will recreate the list of environment variables, which is a non-trivial operation.

Note: For new code, it is recommended to use QProcessEnvironment::systemEnvironment()

This function was introduced in Qt 4.1.

See also QProcessEnvironment::systemEnvironment() and setProcessEnvironment().

pub unsafe fn terminate(&mut self)[src]

Attempts to terminate the process.

Calls C++ function: [slot] void QProcess::terminate().

C++ documentation:

Attempts to terminate the process.

The process may not exit as a result of calling this function (it is given the chance to prompt the user for any unsaved files, etc).

On Windows, terminate() posts a WM_CLOSE message to all top-level windows of the process and then to the main thread of the process itself. On Unix and macOS the SIGTERM signal is sent.

Console applications on Windows that do not run an event loop, or whose event loop does not handle the WM_CLOSE message, can only be terminated by calling kill().

See also kill().

pub unsafe fn tr(
    s: impl CastInto<Ptr<c_char>>,
    c: impl CastInto<Ptr<c_char>>,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QProcess::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: impl CastInto<Ptr<c_char>>,
    c: impl CastInto<Ptr<c_char>>,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QProcess::trUtf8(const char* s, const char* c, int n).

pub unsafe fn wait_for_bytes_written_1a(&mut self, msecs: c_int) -> bool[src]

Reimplemented from QIODevice::waitForBytesWritten().

Calls C++ function: virtual bool QProcess::waitForBytesWritten(int msecs = …).

C++ documentation:

Reimplemented from QIODevice::waitForBytesWritten().

pub unsafe fn wait_for_bytes_written_0a(&mut self) -> bool[src]

Reimplemented from QIODevice::waitForBytesWritten().

Calls C++ function: virtual bool QProcess::waitForBytesWritten().

C++ documentation:

Reimplemented from QIODevice::waitForBytesWritten().

pub unsafe fn wait_for_finished_1a(&mut self, msecs: c_int) -> bool[src]

Blocks until the process has finished and the finished() signal has been emitted, or until msecs milliseconds have passed.

Calls C++ function: bool QProcess::waitForFinished(int msecs = …).

C++ documentation:

Blocks until the process has finished and the finished() signal has been emitted, or until msecs milliseconds have passed.

Returns true if the process finished; otherwise returns false (if the operation timed out, if an error occurred, or if this QProcess is already finished).

This function can operate without an event loop. It is useful when writing non-GUI applications and when performing I/O operations in a non-GUI thread.

Warning: Calling this function from the main (GUI) thread might cause your user interface to freeze.

If msecs is -1, this function will not time out.

See also finished(), waitForStarted(), waitForReadyRead(), and waitForBytesWritten().

pub unsafe fn wait_for_finished_0a(&mut self) -> bool[src]

Blocks until the process has finished and the finished() signal has been emitted, or until msecs milliseconds have passed.

Calls C++ function: bool QProcess::waitForFinished().

C++ documentation:

Blocks until the process has finished and the finished() signal has been emitted, or until msecs milliseconds have passed.

Returns true if the process finished; otherwise returns false (if the operation timed out, if an error occurred, or if this QProcess is already finished).

This function can operate without an event loop. It is useful when writing non-GUI applications and when performing I/O operations in a non-GUI thread.

Warning: Calling this function from the main (GUI) thread might cause your user interface to freeze.

If msecs is -1, this function will not time out.

See also finished(), waitForStarted(), waitForReadyRead(), and waitForBytesWritten().

pub unsafe fn wait_for_ready_read_1a(&mut self, msecs: c_int) -> bool[src]

Reimplemented from QIODevice::waitForReadyRead().

Calls C++ function: virtual bool QProcess::waitForReadyRead(int msecs = …).

C++ documentation:

Reimplemented from QIODevice::waitForReadyRead().

pub unsafe fn wait_for_ready_read_0a(&mut self) -> bool[src]

Reimplemented from QIODevice::waitForReadyRead().

Calls C++ function: virtual bool QProcess::waitForReadyRead().

C++ documentation:

Reimplemented from QIODevice::waitForReadyRead().

pub unsafe fn wait_for_started_1a(&mut self, msecs: c_int) -> bool[src]

Blocks until the process has started and the started() signal has been emitted, or until msecs milliseconds have passed.

Calls C++ function: bool QProcess::waitForStarted(int msecs = …).

C++ documentation:

Blocks until the process has started and the started() signal has been emitted, or until msecs milliseconds have passed.

Returns true if the process was started successfully; otherwise returns false (if the operation timed out or if an error occurred).

This function can operate without an event loop. It is useful when writing non-GUI applications and when performing I/O operations in a non-GUI thread.

Warning: Calling this function from the main (GUI) thread might cause your user interface to freeze.

If msecs is -1, this function will not time out.

Note: On some UNIX operating systems, this function may return true but the process may later report a QProcess::FailedToStart error.

See also started(), waitForReadyRead(), waitForBytesWritten(), and waitForFinished().

pub unsafe fn wait_for_started_0a(&mut self) -> bool[src]

Blocks until the process has started and the started() signal has been emitted, or until msecs milliseconds have passed.

Calls C++ function: bool QProcess::waitForStarted().

C++ documentation:

Blocks until the process has started and the started() signal has been emitted, or until msecs milliseconds have passed.

Returns true if the process was started successfully; otherwise returns false (if the operation timed out or if an error occurred).

This function can operate without an event loop. It is useful when writing non-GUI applications and when performing I/O operations in a non-GUI thread.

Warning: Calling this function from the main (GUI) thread might cause your user interface to freeze.

If msecs is -1, this function will not time out.

Note: On some UNIX operating systems, this function may return true but the process may later report a QProcess::FailedToStart error.

See also started(), waitForReadyRead(), waitForBytesWritten(), and waitForFinished().

pub unsafe fn working_directory(&self) -> CppBox<QString>[src]

If QProcess has been assigned a working directory, this function returns the working directory that the QProcess will enter before the program has started. Otherwise, (i.e., no directory has been assigned,) an empty string is returned, and QProcess will use the application's current working directory instead.

Calls C++ function: QString QProcess::workingDirectory() const.

C++ documentation:

If QProcess has been assigned a working directory, this function returns the working directory that the QProcess will enter before the program has started. Otherwise, (i.e., no directory has been assigned,) an empty string is returned, and QProcess will use the application's current working directory instead.

See also setWorkingDirectory().

Methods from Deref<Target = QIODevice>

pub fn ready_read(&self) -> Signal<()>[src]

This signal is emitted once every time new data is available for reading from the device's current read channel. It will only be emitted again once new data is available, such as when a new payload of network data has arrived on your network socket, or when a new block of data has been appended to your device.

Returns a built-in Qt signal QIODevice::readyRead that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted once every time new data is available for reading from the device's current read channel. It will only be emitted again once new data is available, such as when a new payload of network data has arrived on your network socket, or when a new block of data has been appended to your device.

readyRead() is not emitted recursively; if you reenter the event loop or call waitForReadyRead() inside a slot connected to the readyRead() signal, the signal will not be reemitted (although waitForReadyRead() may still return true).

Note for developers implementing classes derived from QIODevice: you should always emit readyRead() when new data has arrived (do not emit it only because there's data still to be read in your buffers). Do not emit readyRead() in other conditions.

See also bytesWritten().

pub fn channel_ready_read(&self) -> Signal<(c_int,)>[src]

This signal is emitted when new data is available for reading from the device. The channel argument is set to the index of the read channel on which the data has arrived. Unlike readyRead(), it is emitted regardless of the current read channel.

Returns a built-in Qt signal QIODevice::channelReadyRead that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when new data is available for reading from the device. The channel argument is set to the index of the read channel on which the data has arrived. Unlike readyRead(), it is emitted regardless of the current read channel.

channelReadyRead() can be emitted recursively - even for the same channel.

This function was introduced in Qt 5.7.

See also readyRead() and channelBytesWritten().

pub fn bytes_written(&self) -> Signal<(i64,)>[src]

This signal is emitted every time a payload of data has been written to the device's current write channel. The bytes argument is set to the number of bytes that were written in this payload.

Returns a built-in Qt signal QIODevice::bytesWritten that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted every time a payload of data has been written to the device's current write channel. The bytes argument is set to the number of bytes that were written in this payload.

bytesWritten() is not emitted recursively; if you reenter the event loop or call waitForBytesWritten() inside a slot connected to the bytesWritten() signal, the signal will not be reemitted (although waitForBytesWritten() may still return true).

See also readyRead().

pub fn channel_bytes_written(&self) -> Signal<(c_int, i64)>[src]

This signal is emitted every time a payload of data has been written to the device. The bytes argument is set to the number of bytes that were written in this payload, while channel is the channel they were written to. Unlike bytesWritten(), it is emitted regardless of the current write channel.

Returns a built-in Qt signal QIODevice::channelBytesWritten that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted every time a payload of data has been written to the device. The bytes argument is set to the number of bytes that were written in this payload, while channel is the channel they were written to. Unlike bytesWritten(), it is emitted regardless of the current write channel.

channelBytesWritten() can be emitted recursively - even for the same channel.

This function was introduced in Qt 5.7.

See also bytesWritten() and channelReadyRead().

pub fn about_to_close(&self) -> Signal<()>[src]

This signal is emitted when the device is about to close. Connect this signal if you have operations that need to be performed before the device closes (e.g., if you have data in a separate buffer that needs to be written to the device).

Returns a built-in Qt signal QIODevice::aboutToClose that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the device is about to close. Connect this signal if you have operations that need to be performed before the device closes (e.g., if you have data in a separate buffer that needs to be written to the device).

pub fn read_channel_finished(&self) -> Signal<()>[src]

This signal is emitted when the input (reading) stream is closed in this device. It is emitted as soon as the closing is detected, which means that there might still be data available for reading with read().

Returns a built-in Qt signal QIODevice::readChannelFinished that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the input (reading) stream is closed in this device. It is emitted as soon as the closing is detected, which means that there might still be data available for reading with read().

This function was introduced in Qt 4.4.

See also atEnd() and read().

pub unsafe fn at_end(&self) -> bool[src]

Returns true if the current read and write position is at the end of the device (i.e. there is no more data available for reading on the device); otherwise returns false.

Calls C++ function: virtual bool QIODevice::atEnd() const.

C++ documentation:

Returns true if the current read and write position is at the end of the device (i.e. there is no more data available for reading on the device); otherwise returns false.

For some devices, atEnd() can return true even though there is more data to read. This special case only applies to devices that generate data in direct response to you calling read() (e.g., /dev or /proc files on Unix and macOS, or console input / stdin on all platforms).

See also bytesAvailable(), read(), and isSequential().

pub unsafe fn bytes_available(&self) -> i64[src]

Returns the number of bytes that are available for reading. This function is commonly used with sequential devices to determine the number of bytes to allocate in a buffer before reading.

Calls C++ function: virtual qint64 QIODevice::bytesAvailable() const.

C++ documentation:

Returns the number of bytes that are available for reading. This function is commonly used with sequential devices to determine the number of bytes to allocate in a buffer before reading.

Subclasses that reimplement this function must call the base implementation in order to include the size of the buffer of QIODevice. Example:

qint64 CustomDevice::bytesAvailable() const { return buffer.size() + QIODevice::bytesAvailable(); }

See also bytesToWrite(), readyRead(), and isSequential().

pub unsafe fn bytes_to_write(&self) -> i64[src]

For buffered devices, this function returns the number of bytes waiting to be written. For devices with no buffer, this function returns 0.

Calls C++ function: virtual qint64 QIODevice::bytesToWrite() const.

C++ documentation:

For buffered devices, this function returns the number of bytes waiting to be written. For devices with no buffer, this function returns 0.

Subclasses that reimplement this function must call the base implementation in order to include the size of the buffer of QIODevice.

See also bytesAvailable(), bytesWritten(), and isSequential().

pub unsafe fn can_read_line(&self) -> bool[src]

Returns true if a complete line of data can be read from the device; otherwise returns false.

Calls C++ function: virtual bool QIODevice::canReadLine() const.

C++ documentation:

Returns true if a complete line of data can be read from the device; otherwise returns false.

Note that unbuffered devices, which have no way of determining what can be read, always return false.

This function is often called in conjunction with the readyRead() signal.

Subclasses that reimplement this function must call the base implementation in order to include the contents of the QIODevice's buffer. Example:

bool CustomDevice::canReadLine() const { return buffer.contains('\n') || QIODevice::canReadLine(); }

See also readyRead() and readLine().

pub unsafe fn close(&mut self)[src]

First emits aboutToClose(), then closes the device and sets its OpenMode to NotOpen. The error string is also reset.

Calls C++ function: virtual void QIODevice::close().

C++ documentation:

First emits aboutToClose(), then closes the device and sets its OpenMode to NotOpen. The error string is also reset.

See also setOpenMode() and OpenMode.

pub unsafe fn commit_transaction(&mut self)[src]

Completes a read transaction.

Calls C++ function: void QIODevice::commitTransaction().

C++ documentation:

Completes a read transaction.

For sequential devices, all data recorded in the internal buffer during the transaction will be discarded.

This function was introduced in Qt 5.7.

See also startTransaction() and rollbackTransaction().

pub unsafe fn current_read_channel(&self) -> c_int[src]

Returns the index of the current read channel.

Calls C++ function: int QIODevice::currentReadChannel() const.

C++ documentation:

Returns the index of the current read channel.

This function was introduced in Qt 5.7.

See also setCurrentReadChannel(), readChannelCount(), and QProcess.

pub unsafe fn current_write_channel(&self) -> c_int[src]

Returns the the index of the current write channel.

Calls C++ function: int QIODevice::currentWriteChannel() const.

C++ documentation:

Returns the the index of the current write channel.

This function was introduced in Qt 5.7.

See also setCurrentWriteChannel() and writeChannelCount().

pub unsafe fn error_string(&self) -> CppBox<QString>[src]

Returns a human-readable description of the last device error that occurred.

Calls C++ function: QString QIODevice::errorString() const.

C++ documentation:

Returns a human-readable description of the last device error that occurred.

See also setErrorString().

pub unsafe fn get_char(&mut self, c: impl CastInto<MutPtr<c_char>>) -> bool[src]

Reads one character from the device and stores it in c. If c is 0, the character is discarded. Returns true on success; otherwise returns false.

Calls C++ function: bool QIODevice::getChar(char* c).

C++ documentation:

Reads one character from the device and stores it in c. If c is 0, the character is discarded. Returns true on success; otherwise returns false.

See also read(), putChar(), and ungetChar().

pub unsafe fn is_open(&self) -> bool[src]

Returns true if the device is open; otherwise returns false. A device is open if it can be read from and/or written to. By default, this function returns false if openMode() returns NotOpen.

Calls C++ function: bool QIODevice::isOpen() const.

C++ documentation:

Returns true if the device is open; otherwise returns false. A device is open if it can be read from and/or written to. By default, this function returns false if openMode() returns NotOpen.

See also openMode() and OpenMode.

pub unsafe fn is_readable(&self) -> bool[src]

Returns true if data can be read from the device; otherwise returns false. Use bytesAvailable() to determine how many bytes can be read.

Calls C++ function: bool QIODevice::isReadable() const.

C++ documentation:

Returns true if data can be read from the device; otherwise returns false. Use bytesAvailable() to determine how many bytes can be read.

This is a convenience function which checks if the OpenMode of the device contains the ReadOnly flag.

See also openMode() and OpenMode.

pub unsafe fn is_sequential(&self) -> bool[src]

Returns true if this device is sequential; otherwise returns false.

Calls C++ function: virtual bool QIODevice::isSequential() const.

C++ documentation:

Returns true if this device is sequential; otherwise returns false.

Sequential devices, as opposed to a random-access devices, have no concept of a start, an end, a size, or a current position, and they do not support seeking. You can only read from the device when it reports that data is available. The most common example of a sequential device is a network socket. On Unix, special files such as /dev/zero and fifo pipes are sequential.

Regular files, on the other hand, do support random access. They have both a size and a current position, and they also support seeking backwards and forwards in the data stream. Regular files are non-sequential.

See also bytesAvailable().

pub unsafe fn is_text_mode_enabled(&self) -> bool[src]

Returns true if the Text flag is enabled; otherwise returns false.

Calls C++ function: bool QIODevice::isTextModeEnabled() const.

C++ documentation:

Returns true if the Text flag is enabled; otherwise returns false.

See also setTextModeEnabled().

pub unsafe fn is_transaction_started(&self) -> bool[src]

Returns true if a transaction is in progress on the device, otherwise false.

Calls C++ function: bool QIODevice::isTransactionStarted() const.

C++ documentation:

Returns true if a transaction is in progress on the device, otherwise false.

This function was introduced in Qt 5.7.

See also startTransaction().

pub unsafe fn is_writable(&self) -> bool[src]

Returns true if data can be written to the device; otherwise returns false.

Calls C++ function: bool QIODevice::isWritable() const.

C++ documentation:

Returns true if data can be written to the device; otherwise returns false.

This is a convenience function which checks if the OpenMode of the device contains the WriteOnly flag.

See also openMode() and OpenMode.

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QIODevice::metaObject() const.

pub unsafe fn open(&mut self, mode: QFlags<OpenModeFlag>) -> bool[src]

Opens the device and sets its OpenMode to mode. Returns true if successful; otherwise returns false. This function should be called from any reimplementations of open() or other functions that open the device.

Calls C++ function: virtual bool QIODevice::open(QFlags<QIODevice::OpenModeFlag> mode).

C++ documentation:

Opens the device and sets its OpenMode to mode. Returns true if successful; otherwise returns false. This function should be called from any reimplementations of open() or other functions that open the device.

See also openMode() and OpenMode.

pub unsafe fn open_mode(&self) -> QFlags<OpenModeFlag>[src]

Returns the mode in which the device has been opened; i.e. ReadOnly or WriteOnly.

Calls C++ function: QFlags<QIODevice::OpenModeFlag> QIODevice::openMode() const.

C++ documentation:

Returns the mode in which the device has been opened; i.e. ReadOnly or WriteOnly.

See also setOpenMode() and OpenMode.

pub unsafe fn peek_2a(
    &mut self,
    data: impl CastInto<MutPtr<c_char>>,
    maxlen: i64
) -> i64
[src]

Reads at most maxSize bytes from the device into data, without side effects (i.e., if you call read() after peek(), you will get the same data). Returns the number of bytes read. If an error occurs, such as when attempting to peek a device opened in WriteOnly mode, this function returns -1.

Calls C++ function: qint64 QIODevice::peek(char* data, qint64 maxlen).

C++ documentation:

Reads at most maxSize bytes from the device into data, without side effects (i.e., if you call read() after peek(), you will get the same data). Returns the number of bytes read. If an error occurs, such as when attempting to peek a device opened in WriteOnly mode, this function returns -1.

0 is returned when no more data is available for reading.

Example:

bool isExeFile(QFile *file) { char buf[2]; if (file->peek(buf, sizeof(buf)) == sizeof(buf)) return (buf[0] == 'M' && buf[1] == 'Z'); return false; }

This function was introduced in Qt 4.1.

See also read().

pub unsafe fn peek_1a(&mut self, maxlen: i64) -> CppBox<QByteArray>[src]

This is an overloaded function.

Calls C++ function: QByteArray QIODevice::peek(qint64 maxlen).

C++ documentation:

This is an overloaded function.

Peeks at most maxSize bytes from the device, returning the data peeked as a QByteArray.

Example:

bool isExeFile(QFile *file) { return file->peek(2) == "MZ"; }

This function has no way of reporting errors; returning an empty QByteArray can mean either that no data was currently available for peeking, or that an error occurred.

This function was introduced in Qt 4.1.

See also read().

pub unsafe fn pos(&self) -> i64[src]

For random-access devices, this function returns the position that data is written to or read from. For sequential devices or closed devices, where there is no concept of a "current position", 0 is returned.

Calls C++ function: virtual qint64 QIODevice::pos() const.

C++ documentation:

For random-access devices, this function returns the position that data is written to or read from. For sequential devices or closed devices, where there is no concept of a "current position", 0 is returned.

The current read/write position of the device is maintained internally by QIODevice, so reimplementing this function is not necessary. When subclassing QIODevice, use QIODevice::seek() to notify QIODevice about changes in the device position.

See also isSequential() and seek().

pub unsafe fn put_char(&mut self, c: c_char) -> bool[src]

Writes the character c to the device. Returns true on success; otherwise returns false.

Calls C++ function: bool QIODevice::putChar(char c).

C++ documentation:

Writes the character c to the device. Returns true on success; otherwise returns false.

See also write(), getChar(), and ungetChar().

pub unsafe fn qt_metacall(
    &mut self,
    arg1: Call,
    arg2: c_int,
    arg3: impl CastInto<MutPtr<*mut c_void>>
) -> c_int
[src]

Calls C++ function: virtual int QIODevice::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(
    &mut self,
    arg1: impl CastInto<Ptr<c_char>>
) -> MutPtr<c_void>
[src]

Calls C++ function: virtual void* QIODevice::qt_metacast(const char* arg1).

pub unsafe fn read_2a(
    &mut self,
    data: impl CastInto<MutPtr<c_char>>,
    maxlen: i64
) -> i64
[src]

Reads at most maxSize bytes from the device into data, and returns the number of bytes read. If an error occurs, such as when attempting to read from a device opened in WriteOnly mode, this function returns -1.

Calls C++ function: qint64 QIODevice::read(char* data, qint64 maxlen).

C++ documentation:

Reads at most maxSize bytes from the device into data, and returns the number of bytes read. If an error occurs, such as when attempting to read from a device opened in WriteOnly mode, this function returns -1.

0 is returned when no more data is available for reading. However, reading past the end of the stream is considered an error, so this function returns -1 in those cases (that is, reading on a closed socket or after a process has died).

See also readData(), readLine(), and write().

pub unsafe fn read_1a(&mut self, maxlen: i64) -> CppBox<QByteArray>[src]

This is an overloaded function.

Calls C++ function: QByteArray QIODevice::read(qint64 maxlen).

C++ documentation:

This is an overloaded function.

Reads at most maxSize bytes from the device, and returns the data read as a QByteArray.

This function has no way of reporting errors; returning an empty QByteArray can mean either that no data was currently available for reading, or that an error occurred.

pub unsafe fn read_all(&mut self) -> CppBox<QByteArray>[src]

Reads all remaining data from the device, and returns it as a byte array.

Calls C++ function: QByteArray QIODevice::readAll().

C++ documentation:

Reads all remaining data from the device, and returns it as a byte array.

This function has no way of reporting errors; returning an empty QByteArray can mean either that no data was currently available for reading, or that an error occurred.

pub unsafe fn read_channel_count(&self) -> c_int[src]

Returns the number of available read channels if the device is open; otherwise returns 0.

Calls C++ function: int QIODevice::readChannelCount() const.

C++ documentation:

Returns the number of available read channels if the device is open; otherwise returns 0.

This function was introduced in Qt 5.7.

See also writeChannelCount() and QProcess.

pub unsafe fn read_line_2a(
    &mut self,
    data: impl CastInto<MutPtr<c_char>>,
    maxlen: i64
) -> i64
[src]

This function reads a line of ASCII characters from the device, up to a maximum of maxSize - 1 bytes, stores the characters in data, and returns the number of bytes read. If a line could not be read but no error ocurred, this function returns 0. If an error occurs, this function returns the length of what could be read, or -1 if nothing was read.

Calls C++ function: qint64 QIODevice::readLine(char* data, qint64 maxlen).

C++ documentation:

This function reads a line of ASCII characters from the device, up to a maximum of maxSize - 1 bytes, stores the characters in data, and returns the number of bytes read. If a line could not be read but no error ocurred, this function returns 0. If an error occurs, this function returns the length of what could be read, or -1 if nothing was read.

A terminating '\0' byte is always appended to data, so maxSize must be larger than 1.

Data is read until either of the following conditions are met:

  • The first '\n' character is read.
  • maxSize - 1 bytes are read.
  • The end of the device data is detected.

For example, the following code reads a line of characters from a file:

QFile file("box.txt"); if (file.open(QFile::ReadOnly)) { char buf[1024]; qint64 lineLength = file.readLine(buf, sizeof(buf)); if (lineLength != -1) { // the line is available in buf } }

The newline character ('\n') is included in the buffer. If a newline is not encountered before maxSize - 1 bytes are read, a newline will not be inserted into the buffer. On windows newline characters are replaced with '\n'.

This function calls readLineData(), which is implemented using repeated calls to getChar(). You can provide a more efficient implementation by reimplementing readLineData() in your own subclass.

See also getChar(), read(), and write().

pub unsafe fn read_line_1a(&mut self, maxlen: i64) -> CppBox<QByteArray>[src]

This is an overloaded function.

Calls C++ function: QByteArray QIODevice::readLine(qint64 maxlen = …).

C++ documentation:

This is an overloaded function.

Reads a line from the device, but no more than maxSize characters, and returns the result as a byte array.

This function has no way of reporting errors; returning an empty QByteArray can mean either that no data was currently available for reading, or that an error occurred.

pub unsafe fn read_line_0a(&mut self) -> CppBox<QByteArray>[src]

This is an overloaded function.

Calls C++ function: QByteArray QIODevice::readLine().

C++ documentation:

This is an overloaded function.

Reads a line from the device, but no more than maxSize characters, and returns the result as a byte array.

This function has no way of reporting errors; returning an empty QByteArray can mean either that no data was currently available for reading, or that an error occurred.

pub unsafe fn reset(&mut self) -> bool[src]

Seeks to the start of input for random-access devices. Returns true on success; otherwise returns false (for example, if the device is not open).

Calls C++ function: virtual bool QIODevice::reset().

C++ documentation:

Seeks to the start of input for random-access devices. Returns true on success; otherwise returns false (for example, if the device is not open).

Note that when using a QTextStream on a QFile, calling reset() on the QFile will not have the expected result because QTextStream buffers the file. Use the QTextStream::seek() function instead.

See also seek().

pub unsafe fn rollback_transaction(&mut self)[src]

Rolls back a read transaction.

Calls C++ function: void QIODevice::rollbackTransaction().

C++ documentation:

Rolls back a read transaction.

Restores the input stream to the point of the startTransaction() call. This function is commonly used to rollback the transaction when an incomplete read was detected prior to committing the transaction.

This function was introduced in Qt 5.7.

See also startTransaction() and commitTransaction().

pub unsafe fn seek(&mut self, pos: i64) -> bool[src]

For random-access devices, this function sets the current position to pos, returning true on success, or false if an error occurred. For sequential devices, the default behavior is to produce a warning and return false.

Calls C++ function: virtual bool QIODevice::seek(qint64 pos).

C++ documentation:

For random-access devices, this function sets the current position to pos, returning true on success, or false if an error occurred. For sequential devices, the default behavior is to produce a warning and return false.

When subclassing QIODevice, you must call QIODevice::seek() at the start of your function to ensure integrity with QIODevice's built-in buffer.

See also pos() and isSequential().

pub unsafe fn set_current_read_channel(&mut self, channel: c_int)[src]

Sets the current read channel of the QIODevice to the given channel. The current input channel is used by the functions read(), readAll(), readLine(), and getChar(). It also determines which channel triggers QIODevice to emit readyRead().

Calls C++ function: void QIODevice::setCurrentReadChannel(int channel).

C++ documentation:

Sets the current read channel of the QIODevice to the given channel. The current input channel is used by the functions read(), readAll(), readLine(), and getChar(). It also determines which channel triggers QIODevice to emit readyRead().

This function was introduced in Qt 5.7.

See also currentReadChannel(), readChannelCount(), and QProcess.

pub unsafe fn set_current_write_channel(&mut self, channel: c_int)[src]

Sets the current write channel of the QIODevice to the given channel. The current output channel is used by the functions write(), putChar(). It also determines which channel triggers QIODevice to emit bytesWritten().

Calls C++ function: void QIODevice::setCurrentWriteChannel(int channel).

C++ documentation:

Sets the current write channel of the QIODevice to the given channel. The current output channel is used by the functions write(), putChar(). It also determines which channel triggers QIODevice to emit bytesWritten().

This function was introduced in Qt 5.7.

See also currentWriteChannel() and writeChannelCount().

pub unsafe fn set_text_mode_enabled(&mut self, enabled: bool)[src]

If enabled is true, this function sets the Text flag on the device; otherwise the Text flag is removed. This feature is useful for classes that provide custom end-of-line handling on a QIODevice.

Calls C++ function: void QIODevice::setTextModeEnabled(bool enabled).

C++ documentation:

If enabled is true, this function sets the Text flag on the device; otherwise the Text flag is removed. This feature is useful for classes that provide custom end-of-line handling on a QIODevice.

The IO device should be opened before calling this function.

See also isTextModeEnabled(), open(), and setOpenMode().

pub unsafe fn size(&self) -> i64[src]

For open random-access devices, this function returns the size of the device. For open sequential devices, bytesAvailable() is returned.

Calls C++ function: virtual qint64 QIODevice::size() const.

C++ documentation:

For open random-access devices, this function returns the size of the device. For open sequential devices, bytesAvailable() is returned.

If the device is closed, the size returned will not reflect the actual size of the device.

See also isSequential() and pos().

pub unsafe fn skip(&mut self, max_size: i64) -> i64[src]

Skips up to maxSize bytes from the device. Returns the number of bytes actually skipped, or -1 on error.

Calls C++ function: qint64 QIODevice::skip(qint64 maxSize).

C++ documentation:

Skips up to maxSize bytes from the device. Returns the number of bytes actually skipped, or -1 on error.

This function does not wait and only discards the data that is already available for reading.

If the device is opened in text mode, end-of-line terminators are translated to '\n' symbols and count as a single byte identically to the read() and peek() behavior.

This function works for all devices, including sequential ones that cannot seek(). It is optimized to skip unwanted data after a peek() call.

For random-access devices, skip() can be used to seek forward from the current position. Negative maxSize values are not allowed.

This function was introduced in Qt 5.10.

See also peek(), seek(), and read().

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0", cpp_lib_version="5.14.0").

pub unsafe fn start_transaction(&mut self)[src]

Starts a new read transaction on the device.

Calls C++ function: void QIODevice::startTransaction().

C++ documentation:

Starts a new read transaction on the device.

Defines a restorable point within the sequence of read operations. For sequential devices, read data will be duplicated internally to allow recovery in case of incomplete reads. For random-access devices, this function saves the current position. Call commitTransaction() or rollbackTransaction() to finish the transaction.

Note: Nesting transactions is not supported.

This function was introduced in Qt 5.7.

See also commitTransaction() and rollbackTransaction().

pub unsafe fn unget_char(&mut self, c: c_char)[src]

Puts the character c back into the device, and decrements the current position unless the position is 0. This function is usually called to "undo" a getChar() operation, such as when writing a backtracking parser.

Calls C++ function: void QIODevice::ungetChar(char c).

C++ documentation:

Puts the character c back into the device, and decrements the current position unless the position is 0. This function is usually called to "undo" a getChar() operation, such as when writing a backtracking parser.

If c was not previously read from the device, the behavior is undefined.

Note: This function is not available while a transaction is in progress.

pub unsafe fn wait_for_bytes_written(&mut self, msecs: c_int) -> bool[src]

For buffered devices, this function waits until a payload of buffered written data has been written to the device and the bytesWritten() signal has been emitted, or until msecs milliseconds have passed. If msecs is -1, this function will not time out. For unbuffered devices, it returns immediately.

Calls C++ function: virtual bool QIODevice::waitForBytesWritten(int msecs).

C++ documentation:

For buffered devices, this function waits until a payload of buffered written data has been written to the device and the bytesWritten() signal has been emitted, or until msecs milliseconds have passed. If msecs is -1, this function will not time out. For unbuffered devices, it returns immediately.

Returns true if a payload of data was written to the device; otherwise returns false (i.e. if the operation timed out, or if an error occurred).

This function can operate without an event loop. It is useful when writing non-GUI applications and when performing I/O operations in a non-GUI thread.

If called from within a slot connected to the bytesWritten() signal, bytesWritten() will not be reemitted.

Reimplement this function to provide a blocking API for a custom device. The default implementation does nothing, and returns false.

Warning: Calling this function from the main (GUI) thread might cause your user interface to freeze.

See also waitForReadyRead().

pub unsafe fn wait_for_ready_read(&mut self, msecs: c_int) -> bool[src]

Blocks until new data is available for reading and the readyRead() signal has been emitted, or until msecs milliseconds have passed. If msecs is -1, this function will not time out.

Calls C++ function: virtual bool QIODevice::waitForReadyRead(int msecs).

C++ documentation:

Blocks until new data is available for reading and the readyRead() signal has been emitted, or until msecs milliseconds have passed. If msecs is -1, this function will not time out.

Returns true if new data is available for reading; otherwise returns false (if the operation timed out or if an error occurred).

This function can operate without an event loop. It is useful when writing non-GUI applications and when performing I/O operations in a non-GUI thread.

If called from within a slot connected to the readyRead() signal, readyRead() will not be reemitted.

Reimplement this function to provide a blocking API for a custom device. The default implementation does nothing, and returns false.

Warning: Calling this function from the main (GUI) thread might cause your user interface to freeze.

See also waitForBytesWritten().

pub unsafe fn write_char_i64(
    &mut self,
    data: impl CastInto<Ptr<c_char>>,
    len: i64
) -> i64
[src]

Writes at most maxSize bytes of data from data to the device. Returns the number of bytes that were actually written, or -1 if an error occurred.

Calls C++ function: qint64 QIODevice::write(const char* data, qint64 len).

C++ documentation:

Writes at most maxSize bytes of data from data to the device. Returns the number of bytes that were actually written, or -1 if an error occurred.

See also read() and writeData().

pub unsafe fn write_char(&mut self, data: impl CastInto<Ptr<c_char>>) -> i64[src]

This is an overloaded function.

Calls C++ function: qint64 QIODevice::write(const char* data).

C++ documentation:

This is an overloaded function.

Writes data from a zero-terminated string of 8-bit characters to the device. Returns the number of bytes that were actually written, or -1 if an error occurred. This is equivalent to

... QIODevice::write(data, qstrlen(data)); ...

This function was introduced in Qt 4.5.

See also read() and writeData().

pub unsafe fn write_q_byte_array(
    &mut self,
    data: impl CastInto<Ref<QByteArray>>
) -> i64
[src]

This is an overloaded function.

Calls C++ function: qint64 QIODevice::write(const QByteArray& data).

C++ documentation:

This is an overloaded function.

Writes the content of byteArray to the device. Returns the number of bytes that were actually written, or -1 if an error occurred.

See also read() and writeData().

pub unsafe fn write_channel_count(&self) -> c_int[src]

Returns the number of available write channels if the device is open; otherwise returns 0.

Calls C++ function: int QIODevice::writeChannelCount() const.

C++ documentation:

Returns the number of available write channels if the device is open; otherwise returns 0.

This function was introduced in Qt 5.7.

See also readChannelCount().

Trait Implementations

impl CppDeletable for QProcess[src]

unsafe fn delete(&mut self)[src]

Destructs the QProcess object, i.e., killing the process.

Calls C++ function: virtual [destructor] void QProcess::~QProcess().

C++ documentation:

Destructs the QProcess object, i.e., killing the process.

Note that this function will not return until the process is terminated.

impl Deref for QProcess[src]

type Target = QIODevice

The resulting type after dereferencing.

fn deref(&self) -> &QIODevice[src]

Calls C++ function: QIODevice* static_cast<QIODevice*>(QProcess* ptr).

impl DerefMut for QProcess[src]

fn deref_mut(&mut self) -> &mut QIODevice[src]

Calls C++ function: QIODevice* static_cast<QIODevice*>(QProcess* ptr).

impl DynamicCast<QProcess> for QIODevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QIODevice>) -> Ptr<QProcess>[src]

Calls C++ function: QProcess* dynamic_cast<QProcess*>(QIODevice* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QIODevice>) -> MutPtr<QProcess>[src]

Calls C++ function: QProcess* dynamic_cast<QProcess*>(QIODevice* ptr).

impl DynamicCast<QProcess> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QProcess>[src]

Calls C++ function: QProcess* dynamic_cast<QProcess*>(QObject* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QObject>) -> MutPtr<QProcess>[src]

Calls C++ function: QProcess* dynamic_cast<QProcess*>(QObject* ptr).

impl StaticDowncast<QProcess> for QIODevice[src]

unsafe fn static_downcast(ptr: Ptr<QIODevice>) -> Ptr<QProcess>[src]

Calls C++ function: QProcess* static_cast<QProcess*>(QIODevice* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QIODevice>) -> MutPtr<QProcess>[src]

Calls C++ function: QProcess* static_cast<QProcess*>(QIODevice* ptr).

impl StaticDowncast<QProcess> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QProcess>[src]

Calls C++ function: QProcess* static_cast<QProcess*>(QObject* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QObject>) -> MutPtr<QProcess>[src]

Calls C++ function: QProcess* static_cast<QProcess*>(QObject* ptr).

impl StaticUpcast<QIODevice> for QProcess[src]

unsafe fn static_upcast(ptr: Ptr<QProcess>) -> Ptr<QIODevice>[src]

Calls C++ function: QIODevice* static_cast<QIODevice*>(QProcess* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QProcess>) -> MutPtr<QIODevice>[src]

Calls C++ function: QIODevice* static_cast<QIODevice*>(QProcess* ptr).

impl StaticUpcast<QObject> for QProcess[src]

unsafe fn static_upcast(ptr: Ptr<QProcess>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QProcess* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QProcess>) -> MutPtr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QProcess* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.