Qt 5.9 | Qt Serial Port | C++ Classes | QSerialPort

Qt 5.9.4 Reference Documentation

# Obsolete Members for QSerialPort

The following members of class QSerialPort are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

## Public Types

`(obsolete)` enum | DataErrorPolicy { SkipPolicy, PassZeroPolicy, IgnorePolicy, StopReceivingPolicy, UnknownPolicy }

## Properties

- `(obsolete)` dataErrorPolicy : DataErrorPolicy
- `(obsolete)` settingsRestoredOnClose : bool

## Signals

`(obsolete)` void | error(QSerialPort::SerialPortError error)

## Member Type Documentation

### enum QSerialPort::DataErrorPolicy

This enum describes the policies for the received symbols while parity errors were detected.

Constant | Value | Description
--- | --- | ---
`QSerialPort::SkipPolicy` | `0` | Skips the bad character.
`QSerialPort::PassZeroPolicy` | `1` | Replaces bad character with zero.
`QSerialPort::IgnorePolicy` | `2` | Ignores the error for a bad character.
`QSerialPort::StopReceivingPolicy` | `3` | Stops data reception on error.
`QSerialPort::UnknownPolicy` | `-1` | Unknown policy.

See also QSerialPort::dataErrorPolicy.

## Property Documentation

### dataErrorPolicy : DataErrorPolicy

This property holds the error policy for how the process receives characters in the case where a parity error is detected.

If the setting is successful, returns `true`; otherwise returns `false`. The default policy set is IgnorePolicy.

Note: The serial port has to be open before trying to set this property; otherwise returns `false` and sets the NotOpenError error code. This is a bit unusual as opposed to the regular Qt property settings of a class. However, this is a special use case since the property is set through the interaction with the kernel and hardware. Hence, the two scenarios cannot be completely compared to each other.

Access functions:

DataErrorPolicy | dataErrorPolicy() const
bool | setDataErrorPolicy(DataErrorPolicy policy = IgnorePolicy)

Notifier signal:

void | dataErrorPolicyChanged(QSerialPort::DataErrorPolicy policy)

### settingsRestoredOnClose : bool

This property holds the flag which specifies to restore the previous settings when closing the serial port.

If this flag is `true`, the settings will be restored; otherwise not. The default state of the QSerialPort class is to restore the settings.

Access functions:

bool | settingsRestoredOnClose() const
void | setSettingsRestoredOnClose(bool restore)

Notifier signal:

void | settingsRestoredOnCloseChanged(bool restore)

## Member Function Documentation

### `[signal]` void QSerialPort::dataErrorPolicyChanged(QSerialPort::DataErrorPolicy policy)

This signal is emitted after the error policy for how the process receives characters in case of parity error detection has been changed. The new error policy for how the process receives the character in case of parity error detection is passed as policy.

Note: Notifier signal for property dataErrorPolicy.

See also QSerialPort::dataErrorPolicy.

### `[signal]` void QSerialPort::error(QSerialPort::SerialPortError 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(serialPort, static_cast<void(QSerialPort::*)(QSerialPort::SerialPortError)>(&QSerialPort::error),
          [=](QSerialPort::SerialPortError error){ /* ... */ });

### `[signal]` void QSerialPort::settingsRestoredOnCloseChanged(bool restore)

This signal is emitted after the flag which specifies to restore the previous settings while closing the serial port has been changed. The new flag which specifies to restore the previous settings while closing the serial port is passed as restore.

Note: Notifier signal for property settingsRestoredOnClose.

See also QSerialPort::settingsRestoredOnClose.