diff options
-rw-r--r-- | dist/changes-5.2.0 | 4 | ||||
-rw-r--r-- | src/serialport/qserialport.cpp | 6 | ||||
-rw-r--r-- | src/serialport/qserialport.h | 10 | ||||
-rw-r--r-- | src/serialport/qserialport_symbian.cpp | 3 | ||||
-rw-r--r-- | src/serialport/qserialport_win.cpp | 6 |
5 files changed, 24 insertions, 5 deletions
diff --git a/dist/changes-5.2.0 b/dist/changes-5.2.0 index 51e3d44..a51701e 100644 --- a/dist/changes-5.2.0 +++ b/dist/changes-5.2.0 @@ -127,3 +127,7 @@ support the enumeration of such devices. - [QTBUG-35184] Mark the isValid() method in QSerialPortInfo deprecated because it has no common use case. + +- [QTBUG-35215] Mark the QSerialPort::UnknownParity method in QSerialPort +deprecated because it has no use case, and was added mistakenly. There is no +such a "standard" serial port parity behavior. diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp index 7c332cc..9155be9 100644 --- a/src/serialport/qserialport.cpp +++ b/src/serialport/qserialport.cpp @@ -71,7 +71,7 @@ QSerialPortPrivateData::QSerialPortPrivateData(QSerialPort *q) , inputBaudRate(0) , outputBaudRate(0) , dataBits(QSerialPort::UnknownDataBits) - , parity(QSerialPort::UnknownParity) + , parity(QSerialPort::NoParity) , stopBits(QSerialPort::UnknownStopBits) , flow(QSerialPort::UnknownFlowControl) , policy(QSerialPort::IgnorePolicy) @@ -227,7 +227,9 @@ int QSerialPortPrivateData::timeoutValue(int msecs, int elapsed) \value OddParity Odd parity. \value SpaceParity Space parity. \value MarkParity Mark parity. - \value UnknownParity Unknown parity. + \value UnknownParity Unknown parity. This value is obsolete. It is + provided to keep old source code working. We + strongly advise against using it in new code. \sa QSerialPort::parity */ diff --git a/src/serialport/qserialport.h b/src/serialport/qserialport.h index 3e04396..66e262b 100644 --- a/src/serialport/qserialport.h +++ b/src/serialport/qserialport.h @@ -114,9 +114,19 @@ public: OddParity = 3, SpaceParity = 4, MarkParity = 5, +#if !defined(Q_CC_GNU) && !defined(Q_CC_CLANG) UnknownParity = -1 +#endif }; +#if QT_DEPRECATED_SINCE(5, 2) +#if defined(Q_CC_GNU) || defined(Q_CC_CLANG) + QT_DEPRECATED static const Parity UnknownParity = Parity(-1); +#elif defined _MSC_VER +#pragma deprecated(UnknownParity) +#endif +#endif + enum StopBits { OneStop = 1, OneAndHalfStop = 3, diff --git a/src/serialport/qserialport_symbian.cpp b/src/serialport/qserialport_symbian.cpp index d905db1..1c03565 100644 --- a/src/serialport/qserialport_symbian.cpp +++ b/src/serialport/qserialport_symbian.cpp @@ -455,7 +455,8 @@ void QSerialPortPrivate::detectDefaultSettings() parity = QSerialPort::SpaceParity; break; default: - parity = QSerialPort::UnknownParity; + qWarning("%s: Unexpected parity settings", Q_FUNC_INFO); + parity = QSerialPort::NoParity; break; } diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index 597f63e..f5daabc 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -905,8 +905,10 @@ void QSerialPortPrivate::detectDefaultSettings() parity = QSerialPort::EvenParity; else if ((currentDcb.Parity == ODDPARITY) && currentDcb.fParity) parity = QSerialPort::OddParity; - else - parity = QSerialPort::UnknownParity; + else { + qWarning("%s: Unexpected parity settings", Q_FUNC_INFO); + parity = QSerialPort::NoParity; + } // Detect stopbits. switch (currentDcb.StopBits) { |