Obsolete Members for QSerialPort

以下成员源于类 QSerialPort 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

公共类型

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

特性

公共函数

(obsolete) QSerialPort::DataErrorPolicy dataErrorPolicy () const
(obsolete) bool setDataErrorPolicy (QSerialPort::DataErrorPolicy policy = IgnorePolicy)
(obsolete) void setSettingsRestoredOnClose (bool restore )
(obsolete) bool settingsRestoredOnClose () const

信号

(obsolete) void dataErrorPolicyChanged (QSerialPort::DataErrorPolicy policy )
(obsolete) void error (QSerialPort::SerialPortError error )
(obsolete) void settingsRestoredOnCloseChanged (bool restore )

成员类型文档编制

enum QSerialPort:: DataErrorPolicy

This enum is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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

常量 描述
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.

另请参阅 QSerialPort::dataErrorPolicy .

特性文档编制

dataErrorPolicy : DataErrorPolicy

This property is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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 ;否则返回 false . The default policy set is IgnorePolicy .

注意: 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.

访问函数:

QSerialPort::DataErrorPolicy dataErrorPolicy () const
bool setDataErrorPolicy (QSerialPort::DataErrorPolicy policy = IgnorePolicy)

通知程序信号:

void dataErrorPolicyChanged (QSerialPort::DataErrorPolicy policy )

settingsRestoredOnClose : bool

This property is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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.

访问函数:

bool settingsRestoredOnClose () const
void setSettingsRestoredOnClose (bool restore )

通知程序信号:

void settingsRestoredOnCloseChanged (bool restore )

成员函数文档编制

[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 .

注意: 通知程序信号对于特性 dataErrorPolicy .

另请参阅 QSerialPort::dataErrorPolicy .

[signal] void QSerialPort:: error ( QSerialPort::SerialPortError error )

此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。

使用 errorOccurred () 代替。

注意: 信号 error 在此类中被重载。通过使用函数指针句法连接到此信号,Qt 提供用于获得如此范例展示的函数指针的方便帮助程序:

connect(serialPort, QOverload<QSerialPort::SerialPortError>::of(&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 .

注意: 通知程序信号对于特性 settingsRestoredOnClose .

另请参阅 QSerialPort::settingsRestoredOnClose .