Obsolete Members for QSerialPort

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

公共类型

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

特性

信号

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

成员类型文档编制

enum QSerialPort:: DataErrorPolicy

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

访问函数:

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

通知程序信号:

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.

访问函数:

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 在此类中是重载。要使用函数指针句法连接到此信号,必须在静态铸造中指定信号类型,如此范例所示:

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 .

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

另请参阅 QSerialPort::settingsRestoredOnClose .