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 和設置 NotOpenError 錯誤代碼。這有點與眾不同,而不是如常規類的 Qt 特性設置。不管怎樣,這是特殊用例,由於特性是透過與內核和硬件的交互來設置的。因此,這 2 種情景無法完全相互比較。

訪問函數:

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 .