diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-08-05 13:43:48 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-08-05 14:40:35 +0200 |
commit | b97dd9ea7a8e9aeeb63dcf173afa722f37d9a573 (patch) | |
tree | 19df2564b40940401bf13d42e8ceebf1f866ebdb | |
parent | ad2628329e1685dbccd0ac3c5011336cd2c4f786 (diff) | |
download | qtserialport-b97dd9ea7a8e9aeeb63dcf173afa722f37d9a573.tar.gz |
Remove usages of deprecated APIs
- Fixed the build with disabled deprecated APIs.
- Made the docs for deprecated APIs to compile conditionally,
based on the deprecation version.
Task-number: QTBUG-76491
Change-Id: I38fbd84254d3d35b2bc208994c9fd70142450ad8
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r-- | examples/serialport/blockingslave/dialog.cpp | 3 | ||||
-rw-r--r-- | examples/serialport/cenumerator/main.cpp | 3 | ||||
-rw-r--r-- | examples/serialport/enumerator/main.cpp | 3 | ||||
-rw-r--r-- | src/serialport/qserialport.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qserialport/tst_qserialport.cpp | 8 |
5 files changed, 13 insertions, 10 deletions
diff --git a/examples/serialport/blockingslave/dialog.cpp b/examples/serialport/blockingslave/dialog.cpp index 1723086..b95f3e7 100644 --- a/examples/serialport/blockingslave/dialog.cpp +++ b/examples/serialport/blockingslave/dialog.cpp @@ -99,8 +99,7 @@ Dialog::Dialog(QWidget *parent) : connect(m_serialPortComboBox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, &Dialog::activateRunButton); - connect(m_waitRequestSpinBox, QOverload<const QString &>::of(&QSpinBox::valueChanged), - this, &Dialog::activateRunButton); + connect(m_waitRequestSpinBox, &QSpinBox::textChanged, this, &Dialog::activateRunButton); connect(m_responseLineEdit, &QLineEdit::textChanged, this, &Dialog::activateRunButton); } diff --git a/examples/serialport/cenumerator/main.cpp b/examples/serialport/cenumerator/main.cpp index af6d7e4..902a793 100644 --- a/examples/serialport/cenumerator/main.cpp +++ b/examples/serialport/cenumerator/main.cpp @@ -80,8 +80,7 @@ int main(int argc, char *argv[]) : blankString) << endl << "Product Identifier: " << (serialPortInfo.hasProductIdentifier() ? QByteArray::number(serialPortInfo.productIdentifier(), 16) - : blankString) << endl - << "Busy: " << (serialPortInfo.isBusy() ? "Yes" : "No") << endl; + : blankString) << endl; } return 0; diff --git a/examples/serialport/enumerator/main.cpp b/examples/serialport/enumerator/main.cpp index fef1ce0..ee21351 100644 --- a/examples/serialport/enumerator/main.cpp +++ b/examples/serialport/enumerator/main.cpp @@ -70,8 +70,7 @@ int main(int argc, char *argv[]) + QObject::tr("Manufacturer: ") + info.manufacturer() + "\n" + QObject::tr("Serial number: ") + info.serialNumber() + "\n" + QObject::tr("Vendor Identifier: ") + (info.hasVendorIdentifier() ? QString::number(info.vendorIdentifier(), 16) : QString()) + "\n" - + QObject::tr("Product Identifier: ") + (info.hasProductIdentifier() ? QString::number(info.productIdentifier(), 16) : QString()) + "\n" - + QObject::tr("Busy: ") + (info.isBusy() ? QObject::tr("Yes") : QObject::tr("No")) + "\n"; + + QObject::tr("Product Identifier: ") + (info.hasProductIdentifier() ? QString::number(info.productIdentifier(), 16) : QString()) + "\n"; auto label = new QLabel(s); layout->addWidget(label); diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp index 7732855..44d6cd1 100644 --- a/src/serialport/qserialport.cpp +++ b/src/serialport/qserialport.cpp @@ -102,7 +102,9 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo) error = errorInfo.errorCode; q->setErrorString(errorInfo.errorString); emit q->errorOccurred(error); +#if QT_DEPRECATED_SINCE(5, 8) emit q->error(error); +#endif } /*! @@ -347,6 +349,7 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo) QSerialPort::requestToSend */ +#if QT_DEPRECATED_SINCE(5, 2) /*! \enum QSerialPort::DataErrorPolicy \obsolete @@ -362,6 +365,7 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo) \sa QSerialPort::dataErrorPolicy */ +#endif /*! \enum QSerialPort::SerialPortError @@ -1162,12 +1166,14 @@ void QSerialPort::clearError() d->setError(QSerialPortErrorInfo(QSerialPort::NoError)); } +#if QT_DEPRECATED_SINCE(5, 8) /*! \fn void QSerialPort::error(SerialPortError error) \obsolete Use errorOccurred() instead. */ +#endif /*! \fn void QSerialPort::errorOccurred(SerialPortError error) diff --git a/tests/auto/qserialport/tst_qserialport.cpp b/tests/auto/qserialport/tst_qserialport.cpp index 94eaaa5..f55dac7 100644 --- a/tests/auto/qserialport/tst_qserialport.cpp +++ b/tests/auto/qserialport/tst_qserialport.cpp @@ -272,7 +272,7 @@ void tst_QSerialPort::openExisting() for (const QString &serialPortName : qAsConst(m_availablePortNames)) { QSerialPort serialPort(serialPortName); - QSignalSpy errorSpy(&serialPort, static_cast<void (QSerialPort::*)(QSerialPort::SerialPortError)>(&QSerialPort::error)); + QSignalSpy errorSpy(&serialPort, &QSerialPort::errorOccurred); QVERIFY(errorSpy.isValid()); QCOMPARE(serialPort.portName(), serialPortName); @@ -304,7 +304,7 @@ void tst_QSerialPort::openNotExisting() QSerialPort serialPort(serialPortName); - QSignalSpy errorSpy(&serialPort, static_cast<void (QSerialPort::*)(QSerialPort::SerialPortError)>(&QSerialPort::error)); + QSignalSpy errorSpy(&serialPort, &QSerialPort::errorOccurred); QVERIFY(errorSpy.isValid()); QCOMPARE(serialPort.portName(), serialPortName); @@ -477,7 +477,7 @@ void tst_QSerialPort::rts() { QSerialPort serialPort(m_senderPortName); - QSignalSpy errorSpy(&serialPort, static_cast<void (QSerialPort::*)(QSerialPort::SerialPortError)>(&QSerialPort::error)); + QSignalSpy errorSpy(&serialPort, &QSerialPort::errorOccurred); QVERIFY(errorSpy.isValid()); QSignalSpy rtsSpy(&serialPort, &QSerialPort::requestToSendChanged); QVERIFY(rtsSpy.isValid()); @@ -516,7 +516,7 @@ void tst_QSerialPort::dtr() { QSerialPort serialPort(m_senderPortName); - QSignalSpy errorSpy(&serialPort, static_cast<void (QSerialPort::*)(QSerialPort::SerialPortError)>(&QSerialPort::error)); + QSignalSpy errorSpy(&serialPort, &QSerialPort::errorOccurred); QVERIFY(errorSpy.isValid()); QSignalSpy dtrSpy(&serialPort, &QSerialPort::dataTerminalReadyChanged); QVERIFY(dtrSpy.isValid()); |