summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/serialport/qserialport.cpp17
-rw-r--r--src/serialport/qserialport.h3
2 files changed, 18 insertions, 2 deletions
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp
index 02a9422..e62cf69 100644
--- a/src/serialport/qserialport.cpp
+++ b/src/serialport/qserialport.cpp
@@ -131,6 +131,7 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo)
error = errorInfo.errorCode;
q->setErrorString(errorInfo.errorString);
+ emit q->errorOccurred(error);
emit q->error(error);
}
@@ -197,6 +198,10 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo)
If \l{QIODevice::}{waitForReadyRead()} returns false, the
connection has been closed or an error has occurred.
+ If an error occurs at any point in time, QSerialPort will emit the
+ errorOccurred() signal. You can also call error() to find the type of
+ error that occurred last.
+
Programming with a blocking serial port is radically different from
programming with a non-blocking serial port. A blocking serial port
does not require an event loop and typically leads to simpler code.
@@ -1166,9 +1171,17 @@ void QSerialPort::clearError()
/*!
\fn void QSerialPort::error(SerialPortError error)
+ \obsolete
+
+ Use errorOccurred() instead.
+*/
+
+/*!
+ \fn void QSerialPort::errorOccurred(SerialPortError error)
+ \since 5.8
- This signal is emitted after the error has been changed. The new error
- is passed as \a error.
+ This signal is emitted when an error occurs in the serial port.
+ The specified \a error describes the type of error that occurred.
\sa QSerialPort::error
*/
diff --git a/src/serialport/qserialport.h b/src/serialport/qserialport.h
index 0a7ab0f..e4a61ed 100644
--- a/src/serialport/qserialport.h
+++ b/src/serialport/qserialport.h
@@ -284,7 +284,10 @@ Q_SIGNALS:
#endif
void dataTerminalReadyChanged(bool set);
void requestToSendChanged(bool set);
+#if QT_DEPRECATED_SINCE(5, 8)
void error(QSerialPort::SerialPortError serialPortError);
+#endif
+ void errorOccurred(QSerialPort::SerialPortError error);
#if QT_DEPRECATED_SINCE(5, 5)
QT_DEPRECATED void settingsRestoredOnCloseChanged(bool restore);
#endif